diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index 9f43dface4..be2c5de556 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -29,7 +29,9 @@ public interface PaConstant { String PROVINCE_KEY = "province"; String PROVINCE_NAME = "省级"; String CITY_KEY = "city"; - String CITY_NAME = "区县级"; + String CITY_NAME = "市级"; + String DISTRICT_KEY = "district"; + String DISTRICT_NAME = "区县级"; String STREET_KEY = "street"; String STREET_NAME = "乡(镇、街道)级"; String COMMUNITY_KEY = "community"; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java index de045f085a..8a7f9dffb9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java @@ -206,22 +206,31 @@ public class PaCustomerServiceImpl extends BaseServiceImpl agencyLevelList() { List list = new ArrayList<>(); + //省级 AgencyLevelListResultDTO dto1 = new AgencyLevelListResultDTO(); dto1.setLevelKey(PaConstant.PROVINCE_KEY); dto1.setLevelName(PaConstant.PROVINCE_NAME); list.add(dto1); + //市级 AgencyLevelListResultDTO dto2 = new AgencyLevelListResultDTO(); dto2.setLevelKey(PaConstant.CITY_KEY); dto2.setLevelName(PaConstant.CITY_NAME); list.add(dto2); + //区县级 AgencyLevelListResultDTO dto3 = new AgencyLevelListResultDTO(); - dto3.setLevelKey(PaConstant.STREET_KEY); - dto3.setLevelName(PaConstant.STREET_NAME); + dto3.setLevelKey(PaConstant.DISTRICT_KEY); + dto3.setLevelName(PaConstant.DISTRICT_NAME); list.add(dto3); + //乡镇级 AgencyLevelListResultDTO dto4 = new AgencyLevelListResultDTO(); - dto4.setLevelKey(PaConstant.COMMUNITY_KEY); - dto4.setLevelName(PaConstant.COMMUNITY_NAME); + dto4.setLevelKey(PaConstant.STREET_KEY); + dto4.setLevelName(PaConstant.STREET_NAME); list.add(dto4); + //社区级 + AgencyLevelListResultDTO dto5 = new AgencyLevelListResultDTO(); + dto5.setLevelKey(PaConstant.COMMUNITY_KEY); + dto5.setLevelName(PaConstant.COMMUNITY_NAME); + list.add(dto5); return list; } @@ -364,7 +373,7 @@ public class PaCustomerServiceImpl extends BaseServiceImpl pageInfo = new PageInfo<>(); + PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal()); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml index 99181ddebe..a573549065 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml @@ -20,7 +20,22 @@ id, customer_id, agency_name, - `level`, + ( + CASE + WHEN `level` = 'province' THEN + '省级' + WHEN `level` = 'city' THEN + '市级' + WHEN `level` = 'district' THEN + '区县级' + WHEN `level` = 'street' THEN + '乡(镇、街道)级' + WHEN `level` = 'community' THEN + '社区级' + ELSE + '无' + END + ) AS "level", area_code, province, city, diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml index 609937e09f..484b409121 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml @@ -22,7 +22,22 @@ pc.id AS "customerId", pca.id AS "agencyId", pca.agency_name AS "agencyName", - pca.`level` AS "level", + ( + CASE + WHEN pca.`level` = 'province' THEN + '省级' + WHEN pca.`level` = 'city' THEN + '市级' + WHEN pca.`level` = 'district' THEN + '区县级' + WHEN pca.`level` = 'street' THEN + '乡(镇、街道)级' + WHEN pca.`level` = 'community' THEN + '社区级' + ELSE + '无' + END + ) AS "level", pca.province AS "province", pca.city AS "city", pca.district AS "district", diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ThirdCustomerGridListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ThirdCustomerGridListFormDTO.java new file mode 100644 index 0000000000..5d48df72d7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ThirdCustomerGridListFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.form;/** + * Created by 11 on 2020/3/19. + */ + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 第三方-陌生人导览查询附近网格传参定义 + * @ClassName ListCustomerGridFormDTO + * @Author sun + */ +@Data +public class ThirdCustomerGridListFormDTO implements Serializable{ + + private static final long serialVersionUID = -1L; + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空") + private String customerId; + + /** + * 地区编码(城市、区县) + * */ + @NotBlank(message = "地区码不能为空") + private String areaCode; + + /** + * 当前页 + * */ + @Min(value = 1) + private Integer pageNo = 1; + + /** + * 每页显示数量 + * */ + private Integer pageSize = 20; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublicCustomerGridForStrangerResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublicCustomerGridForStrangerResultDTO.java new file mode 100644 index 0000000000..afa1ea9eda --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublicCustomerGridForStrangerResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 单客户-陌生人搜索网格-接口返参 + * @Author sun + */ +@Data +public class PublicCustomerGridForStrangerResultDTO implements Serializable { + private static final long serialVersionUID = -1L; + + /** + * 网格ID + * */ + private String gridId; + + /** + * 客户ID + * */ + private String customerId; + + /** + * 网格名称 + * */ + private String gridName; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 430b560d33..69eecc5d2c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -204,4 +204,16 @@ public class CustomerGridController { return new Result().ok(customerGridService.getGridDataFilterMsg(gridForm)); } + /** + * @return + * @Param + * @Author sun + * @Description 第三方-陌生人导览模块调用-根据地区编码查询客户下的网格列表 + **/ + @PostMapping("querycustomergridlist") + public Result> queryCustomerGridList(@RequestBody ThirdCustomerGridListFormDTO formDTO ){ + ValidatorUtils.validateEntity(formDTO); + return customerGridService.queryCustomerGridList(formDTO); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 86303b5b28..09f71efd99 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -200,4 +200,20 @@ public interface CustomerGridDao extends BaseDao { * @Description 查询机关下网格列表信息 **/ List selectAgencyGridMsgList(@Param("agencyId") String agencyId); + + /** + * @param listCustomerGridFormDTO + * @return + * @Author sun + * @Description 单客户-查询客户整个城市下的网格 + **/ + List selectThirdGridByCityLike(ThirdCustomerGridListFormDTO listCustomerGridFormDTO); + + /** + * @param map + * @return + * @Author sun + * @Description 单客户-指定区时查询当前城市下除该区之外其余的网格 + **/ + List selectThirdRestGridWithoutGivenAreaCode(Map map); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 6ca09779e1..518e20fdb5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -243,4 +243,12 @@ public interface CustomerGridService extends BaseService { * @date 2020.05.13 11:01 **/ CommonDataFilterResultDTO getGridDataFilterMsg(CommonGridIdFormDTO gridIdFormDTO); + + /** + * @return + * @Param + * @Author sun + * @Description 单客户-陌生人导览模块调用-根据地区编码查询客户下的网格列表 + **/ + Result> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 505114f8b0..403e93f3d1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -571,4 +571,48 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO) { + Result> result = new Result<>(); + + String areaCode = formDTO.getAreaCode(); + formDTO.setPageNo((formDTO.getPageNo() - 1) * formDTO.getPageSize()); + + //地区编码如何是00结尾的则查询当前地区数据(实际业务不会存在,因为地区必须选到区县级) + if (areaCode.endsWith(ModuleConstant.LAST_TWO_LETTER_OF_FORMATIVE_CITY_CODE)) { + //城市 - 查全部 + formDTO.setAreaCode(areaCode.substring(0, areaCode.length() - 2)); + List gridList = baseDao.selectThirdGridByCityLike(formDTO); + result.setData(gridList); + result.setCode(ModuleConstant.SUCCESS_CODE_RESULT); + return result; + } else { + //行政区 - 指定行政区在前,所属城市下其余行政区在后 + Map map = new HashMap<>(); + map.put("customerId", formDTO.getCustomerId()); + //地区码格式 六位 [abcxyz] + //ab代表省 + map.put("areaCode", areaCode); + //cx代表市 + map.put("cityCode", areaCode.substring(NumConstant.ZERO, areaCode.length() - NumConstant.TWO)); + //yz代表区 + map.put("provinceCode", areaCode.substring(NumConstant.ZERO, areaCode.length() - NumConstant.FOUR)); + map.put("pageSize", formDTO.getPageSize()); + map.put("pageNo", formDTO.getPageNo()); + + List gridListArea = baseDao.selectThirdRestGridWithoutGivenAreaCode(map); + result.setData(gridListArea); + + return result; + } + + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 52d8e15bc2..ef5998325e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -397,4 +397,111 @@ AND ca.del_flag = '0' AND cg.pid = #{agencyId} + + + + + \ No newline at end of file diff --git a/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java new file mode 100644 index 0000000000..80d539dbb2 --- /dev/null +++ b/epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java @@ -0,0 +1,71 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 单客户-陌生人搜索网格-接口入参 + * @Author sun + */ +@Data +public class PublicCustomerGridListFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空", groups = {AddUserShowGroup.class}) + private String customerId; + /** + * 当前页 + * */ + @Min(value = 1) + private Integer pageNo; + + /** + * 每页数量 + * */ + private Integer pageSize = 20; + + /** + * 地区码 + * */ + private String areaCode; + + /** + * 选定地区编码 + * */ + private String selectedAreaCode; + + /** + * 是否首次位置授权(0:是 1:否) + */ + private Integer isAuthorized; + + /** + * 前端传递的省份 + * */ + @NotBlank(message = "省份信息不能为空") + private String province; + + /** + * 前端传递的城市 + * */ + @NotBlank(message = "城市信息不能为空") + private String city; + + /** + * 前端传递的地区 + * */ + private String area; +} diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java index 57ad839d42..dac2615943 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java @@ -22,10 +22,12 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.CustomerGridListFormDTO; +import com.epmet.dto.form.PublicCustomerGridListFormDTO; import com.epmet.dto.form.StrangerFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.HomeDesignByCustomerResultDTO; import com.epmet.dto.result.MarketContactInfoResultDTO; +import com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO; import com.epmet.service.StrangerAccessRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -108,4 +110,26 @@ public class StrangerResiGuideController { return new Result().ok(dto); } + /** + * @param + * @Author sun + * @Description 单客户-陌生访客根据自动定位获取附近网格数据 + **/ + @PostMapping("publiclocationgridlist") + Result> publicLocationGridList(@RequestBody PublicCustomerGridListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return strangerAccessRecordService.thirdCustomerGridList(formDTO); + } + + /** + * @param + * @Author sun + * @Description 单客户-陌生访客手动选定位置获取附近网格数据 + **/ + @PostMapping("publiclelectcdgridlist") + Result> publicLelectcdGridList(@RequestBody PublicCustomerGridListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return strangerAccessRecordService.thirdCustomerGridList(formDTO); + } + } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index 9295571e93..db9e83fe9d 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -4,7 +4,9 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.form.ThirdCustomerGridListFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -32,8 +34,13 @@ public interface GovOrgFeignClient { @PostMapping("/gov/org/customergrid/querygridlistbyareacode") Result> queryGridListByAreaCode(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO); - - - + /** + * @return + * @Param + * @Author sun + * @Description 单客户-陌生人搜网格-根据地区编码查询客户下的网格列表 + **/ + @PostMapping("/gov/org/customergrid/querycustomergridlist") + Result> queryCustomerGridList(@RequestBody ThirdCustomerGridListFormDTO formDTO); } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index f2370b8c32..589f7c944d 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -4,7 +4,9 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.form.ThirdCustomerGridListFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; @@ -29,4 +31,9 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { public Result> queryGridListByAreaCode(ListCustomerGridFormDTO listCustomerGridFormDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryGridListByAreaCode",listCustomerGridFormDTO); } + + @Override + public Result> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryCustomerGridList",formDTO); + } } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java index 6e0479fa9f..9dbd10519d 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java @@ -6,9 +6,11 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StrangerAccessRecordDTO; import com.epmet.dto.form.CustomerGridListFormDTO; +import com.epmet.dto.form.PublicCustomerGridListFormDTO; import com.epmet.dto.form.StrangerFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO; import com.epmet.entity.StrangerAccessRecordEntity; import java.util.List; @@ -111,5 +113,11 @@ public interface StrangerAccessRecordService extends BaseService getGridHome(TokenDto tokenDTO, StrangerFormDTO formDTO); - + /** + * @return + * @Param + * @Author sun + * @Description 单客户-陌生人根据地区编码查询附近网格列表 + **/ + Result> thirdCustomerGridList(PublicCustomerGridListFormDTO formDTO); } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java index edc0784fa5..14e4f01b8c 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java @@ -18,15 +18,16 @@ import com.epmet.dto.StrangerAccessRecordDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO; import com.epmet.entity.StrangerAccessRecordEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.OperCustomizeFeignClient; import com.epmet.service.StrangerAccessRecordService; +import com.epmet.utils.ModuleConstant; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.epmet.utils.ModuleConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -239,5 +240,57 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl> thirdCustomerGridList(PublicCustomerGridListFormDTO formDTO) { + + ThirdCustomerGridListFormDTO third = new ThirdCustomerGridListFormDTO(); + third.setCustomerId(formDTO.getCustomerId()); + //1.参数设置 + //根据是自动定位还是手动定位获取地区编码值 + third.setAreaCode(ModuleConstant.NOT_POSITION_AUTHORIZED == formDTO.getIsAuthorized() ? + formDTO.getSelectedAreaCode() : formDTO.getAreaCode()); + //分页参数设置 + third.setPageNo(null == formDTO.getPageNo() ? ModuleConstant.MIN_CURRENT_PAGE_NO : formDTO.getPageNo()); + third.setPageSize(formDTO.getPageSize()); + + //2.调用gov-org服务,查询客户网格列表数据 + Result> queryResult = govOrgFeignClient.queryCustomerGridList(third); + if(!queryResult.success()){ + logger.error("调用gov_org服务查询指定地区客户下网格列表失败",queryResult.getCode(),queryResult.getMsg()); + return new Result>().error(queryResult.getCode(), queryResult.getMsg()); + } + List queryList = queryResult.getData(); + + //3.陌生人访问记录表新增数据 + if (null != queryResult && queryList.size() > NumConstant.ZERO) { + StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity(); + //未授权,手动选择 + if (ModuleConstant.NOT_POSITION_AUTHORIZED == formDTO.getIsAuthorized()) { + strangerTrance.setSelectedAreaCode(formDTO.getSelectedAreaCode()); + } else if (ModuleConstant.POSITION_AUTHORIZED == formDTO.getIsAuthorized()) { + //已授权,自动选择 + strangerTrance.setLocationAreaCode(formDTO.getAreaCode()); + } + strangerTrance.setIsAuthorized(formDTO.getIsAuthorized()); + strangerTrance.setGridNumber(queryList.size()); + strangerTrance.setVisitTime(new Date()); + strangerTrance.setProvince(formDTO.getProvince()); + strangerTrance.setCity(formDTO.getCity()); + strangerTrance.setArea(formDTO.getArea()); + insert(strangerTrance); + + return new Result>().ok(queryList); + } else { + //没有查询出结果 + return new Result>().ok(new ArrayList<>()); + } + + } }