|
|
@ -21,27 +21,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.CustomerGridDao; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dao.CustomerStaffGridDao; |
|
|
|
import com.epmet.dto.*; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.CustomerStaffGridDTO; |
|
|
|
import com.epmet.dto.StaffGridListDTO; |
|
|
|
import com.epmet.dto.form.CommonAgencyIdFormDTO; |
|
|
|
import com.epmet.dto.form.CustomerGridFormDTO; |
|
|
|
import com.epmet.dto.form.ListCustomerGridFormDTO; |
|
|
|
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; |
|
|
|
import com.epmet.dto.result.GridInfoResultDTO; |
|
|
|
import com.epmet.entity.CustomerGridEntity; |
|
|
|
import com.epmet.feign.EpmetUserFeignClient; |
|
|
|
import com.epmet.redis.CustomerGridRedis; |
|
|
@ -57,7 +47,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -73,8 +62,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(CustomerGridServiceImpl.class); |
|
|
|
@Autowired |
|
|
|
private CustomerGridRedis customerGridRedis; |
|
|
|
@Autowired |
|
|
|
private CustomerAgencyService customerAgencyService; |
|
|
|
@Autowired |
|
|
|
private EpmetUserFeignClient epmetUserFeignClient; |
|
|
@ -179,51 +166,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
return new Result<CustomerGridDTO>().ok(baseDao.getCustomerGridByGridId(customerGridFormDTO)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<GridInfoResultDTO> getGridInfo(String gridId) { |
|
|
|
GridInfoResultDTO gridInfoResultDTO=new GridInfoResultDTO(); |
|
|
|
CustomerGridDTO customerGridDTO = this.get(gridId); |
|
|
|
if(null==customerGridDTO){ |
|
|
|
return new Result<>(); |
|
|
|
} |
|
|
|
gridInfoResultDTO.setCustomerId(customerGridDTO.getCustomerId()); |
|
|
|
String pids=customerGridDTO.getPids(); |
|
|
|
String[] pidArray = pids.split(":"); |
|
|
|
for(String agencyId:pidArray){ |
|
|
|
CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(agencyId); |
|
|
|
if(null!=customerAgencyDTO){ |
|
|
|
switch(customerAgencyDTO.getLevel()){ |
|
|
|
case "community" : |
|
|
|
//社区级
|
|
|
|
gridInfoResultDTO.setCommuityId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setCommnuityName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "street" : |
|
|
|
//乡(镇、街道)级
|
|
|
|
gridInfoResultDTO.setStreetId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setStreetName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "district": |
|
|
|
//区县级
|
|
|
|
gridInfoResultDTO.setDistrictId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setDistrictName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "city": |
|
|
|
//市级
|
|
|
|
gridInfoResultDTO.setCityId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setCityName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "province": |
|
|
|
//省级
|
|
|
|
gridInfoResultDTO.setProvinceId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setProviceName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result<GridInfoResultDTO>().ok(gridInfoResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param userId |
|
|
|
* @return |
|
|
@ -468,4 +410,49 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<GridInfoResultDTO> getGridInfo(String gridId) { |
|
|
|
GridInfoResultDTO gridInfoResultDTO=new GridInfoResultDTO(); |
|
|
|
CustomerGridDTO customerGridDTO = this.get(gridId); |
|
|
|
if(null==customerGridDTO){ |
|
|
|
return new Result<>(); |
|
|
|
} |
|
|
|
gridInfoResultDTO.setCustomerId(customerGridDTO.getCustomerId()); |
|
|
|
String pids=customerGridDTO.getPids(); |
|
|
|
String[] pidArray = pids.split(":"); |
|
|
|
for(String agencyId:pidArray){ |
|
|
|
CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(agencyId); |
|
|
|
if(null!=customerAgencyDTO){ |
|
|
|
switch(customerAgencyDTO.getLevel()){ |
|
|
|
case "community" : |
|
|
|
//社区级
|
|
|
|
gridInfoResultDTO.setCommuityId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setCommnuityName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "street" : |
|
|
|
//乡(镇、街道)级
|
|
|
|
gridInfoResultDTO.setStreetId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setStreetName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "district": |
|
|
|
//区县级
|
|
|
|
gridInfoResultDTO.setDistrictId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setDistrictName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "city": |
|
|
|
//市级
|
|
|
|
gridInfoResultDTO.setCityId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setCityName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
case "province": |
|
|
|
//省级
|
|
|
|
gridInfoResultDTO.setProvinceId(customerAgencyDTO.getId()); |
|
|
|
gridInfoResultDTO.setProviceName(customerAgencyDTO.getOrganizationName()); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result<GridInfoResultDTO>().ok(gridInfoResultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|