Browse Source

公众号接口调整;单客户陌生人手动、自动搜网格接口

master
sunyuchao 5 years ago
parent
commit
1277eafa26
  1. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java
  2. 19
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  3. 17
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml
  4. 17
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml
  5. 43
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ThirdCustomerGridListFormDTO.java
  6. 29
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PublicCustomerGridForStrangerResultDTO.java
  7. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  8. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  9. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  10. 44
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  11. 107
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  12. 71
      epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/PublicCustomerGridListFormDTO.java
  13. 24
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java
  14. 13
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  15. 7
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  16. 10
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java
  17. 55
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java

4
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";

19
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<PaCustomerDao, PaCust
@Override
public List<AgencyLevelListResultDTO> agencyLevelList() {
List<AgencyLevelListResultDTO> 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<PaCustomerDao, PaCust
}
});
});
PageInfo<CustomerAgencyResultDTO> pageInfo = new PageInfo<>();
PageInfo<CustomerAgencyResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}

17
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,

17
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",

43
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;
}

29
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;
}

12
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<CommonDataFilterResultDTO>().ok(customerGridService.getGridDataFilterMsg(gridForm));
}
/**
* @return
* @Param
* @Author sun
* @Description 第三方-陌生人导览模块调用-根据地区编码查询客户下的网格列表
**/
@PostMapping("querycustomergridlist")
public Result<List<PublicCustomerGridForStrangerResultDTO>> queryCustomerGridList(@RequestBody ThirdCustomerGridListFormDTO formDTO ){
ValidatorUtils.validateEntity(formDTO);
return customerGridService.queryCustomerGridList(formDTO);
}
}

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -200,4 +200,20 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @Description 查询机关下网格列表信息
**/
List<AgencyGridList> selectAgencyGridMsgList(@Param("agencyId") String agencyId);
/**
* @param listCustomerGridFormDTO
* @return
* @Author sun
* @Description 单客户-查询客户整个城市下的网格
**/
List<PublicCustomerGridForStrangerResultDTO> selectThirdGridByCityLike(ThirdCustomerGridListFormDTO listCustomerGridFormDTO);
/**
* @param map
* @return
* @Author sun
* @Description 单客户-指定区时查询当前城市下除该区之外其余的网格
**/
List<PublicCustomerGridForStrangerResultDTO> selectThirdRestGridWithoutGivenAreaCode(Map<String, Object> map);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -243,4 +243,12 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @date 2020.05.13 11:01
**/
CommonDataFilterResultDTO getGridDataFilterMsg(CommonGridIdFormDTO gridIdFormDTO);
/**
* @return
* @Param
* @Author sun
* @Description 单客户-陌生人导览模块调用-根据地区编码查询客户下的网格列表
**/
Result<List<PublicCustomerGridForStrangerResultDTO>> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO);
}

44
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<CustomerGridDao, Cu
}
return dataFilterMsg;
}
/**
* @return
* @Param
* @Author sun
* @Description 第三方-陌生人导览模块调用-根据地区编码查询客户下的网格列表
**/
@Override
public Result<List<PublicCustomerGridForStrangerResultDTO>> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO) {
Result<List<PublicCustomerGridForStrangerResultDTO>> 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<PublicCustomerGridForStrangerResultDTO> gridList = baseDao.selectThirdGridByCityLike(formDTO);
result.setData(gridList);
result.setCode(ModuleConstant.SUCCESS_CODE_RESULT);
return result;
} else {
//行政区 - 指定行政区在前,所属城市下其余行政区在后
Map<String, Object> 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<PublicCustomerGridForStrangerResultDTO> gridListArea = baseDao.selectThirdRestGridWithoutGivenAreaCode(map);
result.setData(gridListArea);
return result;
}
}
}

107
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}
</select>
<!-- 单客户-根据城市地区码前四位匹配到城市下所有网格 -->
<select id="selectThirdGridByCityLike" resultType="com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO">
SELECT
grid.id AS grid_id,
grid.customer_id,
concat( agency.fullname, '-', grid.grid_name ) AS gridName
FROM
CUSTOMER_GRID grid
LEFT JOIN (
SELECT
a1.id,
CASE
WHEN a2.ORGANIZATION_NAME IS NULL THEN
a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME )
END AS fullname
FROM
customer_agency a1
LEFT JOIN customer_agency a2 ON a1.PID = a2.ID
AND a1.del_flag = '0'
WHERE
a1.del_flag = '0'
AND a1.customer_id = #{customerId}
) agency ON grid.PID = agency.ID
WHERE
grid.del_flag = 0
AND
grid.area_code LIKE CONCAT(#{areaCode},'%')
AND
grid.customer_id = #{customerId}
ORDER BY
grid.customer_id,
CONVERT ( gridName USING gbk ) ASC
LIMIT #{pageNo}, #{pageSize}
</select>
<!-- 单客户-根据区县地区码匹配到该地区置顶其余区域在后这种特定排序的数据集 -->
<select id="selectThirdRestGridWithoutGivenAreaCode" parameterType="map" resultType="com.epmet.dto.result.PublicCustomerGridForStrangerResultDTO">
SELECT
c.*
FROM
(
(
SELECT
a.id AS grid_id,
a.customer_id,
concat( agency.fullname, '-', a.grid_name ) AS gridName
FROM
CUSTOMER_GRID a
LEFT JOIN (
SELECT
a1.id,
CASE
WHEN a2.ORGANIZATION_NAME IS NULL THEN
a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME )
END AS fullname
FROM
customer_agency a1
LEFT JOIN customer_agency a2 ON a1.PID = a2.ID
AND a1.del_flag = '0'
WHERE
a1.del_flag = '0'
AND a1.customer_id = #{customerId}
) agency ON a.PID = agency.ID
WHERE
a.del_flag = 0
AND a.area_code = #{areaCode}
AND a.customer_id = #{customerId}
ORDER BY
CONVERT ( gridName USING gbk ) ASC
LIMIT 0,999999999999
)
UNION
(
SELECT
b.id AS grid_id,
b.customer_id,
concat(agency.fullname , '-' ,b.grid_name) as gridName
FROM
CUSTOMER_GRID b
LEFT JOIN (
SELECT
a1.id,
CASE
WHEN a2.ORGANIZATION_NAME IS NULL THEN
a1.ORGANIZATION_NAME ELSE concat( a2.ORGANIZATION_NAME, '-', a1.ORGANIZATION_NAME )
END AS fullname
FROM
customer_agency a1
LEFT JOIN customer_agency a2 ON a1.PID = a2.ID
AND a1.del_flag = '0'
WHERE
a1.del_flag = '0'
AND a1.customer_id = #{customerId}
) agency ON b.PID = agency.ID
WHERE
b.del_flag = 0
AND b.customer_id = #{customerId}
AND b.area_code LIKE CONCAT(#{cityCode},'%')
AND <![CDATA[ b.area_code <> #{areaCode}]]>
ORDER BY
b.area_code DESC ,CONVERT ( gridName USING gbk ) ASC
LIMIT 0,999999999999
)
) AS c
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>

71
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;
}

24
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<MarketContactInfoResultDTO>().ok(dto);
}
/**
* @param
* @Author sun
* @Description 单客户-陌生访客根据自动定位获取附近网格数据
**/
@PostMapping("publiclocationgridlist")
Result<List<PublicCustomerGridForStrangerResultDTO>> publicLocationGridList(@RequestBody PublicCustomerGridListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return strangerAccessRecordService.thirdCustomerGridList(formDTO);
}
/**
* @param
* @Author sun
* @Description 单客户-陌生访客手动选定位置获取附近网格数据
**/
@PostMapping("publiclelectcdgridlist")
Result<List<PublicCustomerGridForStrangerResultDTO>> publicLelectcdGridList(@RequestBody PublicCustomerGridListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return strangerAccessRecordService.thirdCustomerGridList(formDTO);
}
}

13
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<List<CustomerGridForStrangerResultDTO>> queryGridListByAreaCode(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO);
/**
* @return
* @Param
* @Author sun
* @Description 单客户-陌生人搜网格-根据地区编码查询客户下的网格列表
**/
@PostMapping("/gov/org/customergrid/querycustomergridlist")
Result<List<PublicCustomerGridForStrangerResultDTO>> queryCustomerGridList(@RequestBody ThirdCustomerGridListFormDTO formDTO);
}

7
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<List<CustomerGridForStrangerResultDTO>> queryGridListByAreaCode(ListCustomerGridFormDTO listCustomerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryGridListByAreaCode",listCustomerGridFormDTO);
}
@Override
public Result<List<PublicCustomerGridForStrangerResultDTO>> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryCustomerGridList",formDTO);
}
}

10
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<StrangerAccessR
*/
Result<HomeDesignByCustomerResultDTO> getGridHome(TokenDto tokenDTO, StrangerFormDTO formDTO);
/**
* @return
* @Param
* @Author sun
* @Description 单客户-陌生人根据地区编码查询附近网格列表
**/
Result<List<PublicCustomerGridForStrangerResultDTO>> thirdCustomerGridList(PublicCustomerGridListFormDTO formDTO);
}

55
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<StrangerAcc
return operCustomizeFeignClient.getHomeReleaseByCustomer(customerHomeFormDTO);
}
/**
* @return formDTO
* @Param
* @Author sun
* @Description 单客户-陌生人根据地区编码查询附近网格列表
**/
@Override
public Result<List<PublicCustomerGridForStrangerResultDTO>> 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<List<PublicCustomerGridForStrangerResultDTO>> queryResult = govOrgFeignClient.queryCustomerGridList(third);
if(!queryResult.success()){
logger.error("调用gov_org服务查询指定地区客户下网格列表失败",queryResult.getCode(),queryResult.getMsg());
return new Result<List<PublicCustomerGridForStrangerResultDTO>>().error(queryResult.getCode(), queryResult.getMsg());
}
List<PublicCustomerGridForStrangerResultDTO> 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<List<PublicCustomerGridForStrangerResultDTO>>().ok(queryList);
} else {
//没有查询出结果
return new Result<List<PublicCustomerGridForStrangerResultDTO>>().ok(new ArrayList<>());
}
}
}

Loading…
Cancel
Save