Browse Source

调整陌生人导览、政府端组织代码规范

dev
wangchao 6 years ago
parent
commit
a168126125
  1. 2
      epmet-module/gov-org/gov-org-client/pom.xml
  2. 38
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java
  3. 8
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStrangerResultDTO.java
  4. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  5. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  6. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  7. 33
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  8. 60
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  9. 61
      epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/CustomerGridListFormDTO.java
  10. 26
      epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/result/CustomerGridListResultDTO.java
  11. 37
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerAccessRecordController.java
  12. 9
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java
  13. 24
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  14. 32
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignFallBack.java
  15. 34
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/impl/GovOrgFeginFallBack.java
  16. 21
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java
  17. 74
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java

2
epmet-module/gov-org/gov-org-client/pom.xml

@ -10,7 +10,7 @@
</parent>
<artifactId>gov-org-client</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>

38
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/ListCustomerGridFormDTO.java

@ -0,0 +1,38 @@
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 wangc
* @date 2020.03.19 15:00
*/
@Data
public class ListCustomerGridFormDTO implements Serializable{
private static final long serialVersionUID = -1L;
/**
* 地区编码城市区县
* */
@NotBlank(message = "地区码不能为空")
private String areaCode;
/**
* 当前页
* */
@Min(value = 1)
private Integer pageNo;
/**
* 每页显示数量
* */
private Integer pageSize = 20;
}

8
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStangerResultDTO.java → epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStrangerResultDTO.java

@ -1,6 +1,4 @@
package com.epmet.dto.result;/**
* Created by 11 on 2020/3/19.
*/
package com.epmet.dto.result;
import lombok.Data;
@ -8,12 +6,12 @@ import java.io.Serializable;
/**
* @Description 陌生人搜索网格返回结果
* @ClassName CustomerGridForStangerResultDTO
* @ClassName CustomerGridForStrangerResultDTO
* @Author wangc
* @date 2020.03.19 00:38
*/
@Data
public class CustomerGridForStangerResultDTO implements Serializable {
public class CustomerGridForStrangerResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -26,7 +26,8 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.excel.CustomerGridExcel;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
@ -93,10 +94,17 @@ public class CustomerGridController {
}
/**
* @Description 陌生人导览模块调用 根据陌生揽客传入的地区码进行分页查询显示
* @Param ListCustomerGridFormDTO
* @return Result<List<CustomerGridForStrangerResultDTO>>
* @Author wangc
* @Date 2020.03.19 15:23
**/
@PostMapping("queryListForStrangerByOrder")
public Result<List<CustomerGridForStrangerResultDTO>> queryListForStrangerByOrder(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO ){
@GetMapping("queryListForStrangerByOrder")
public Result<List<CustomerGridForStangerResultDTO>> queryListForStrangerByOrder(@RequestParam("areaCode")String areaCode, @RequestParam("pageNo") Integer pageNo, Integer pageSize){
return customerGridService.ListGridForStrangerByOrder(areaCode, pageNo, pageSize);
ValidatorUtils.validateEntity(listCustomerGridFormDTO);
return customerGridService.listGridForStrangerByOrder(listCustomerGridFormDTO);
}
}

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

@ -18,7 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -34,13 +34,34 @@ import java.util.List;
@Mapper
public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
//查特定区的网格
List<CustomerGridForStangerResultDTO> selectGridByAreaCode(@Param("areaCode")String areaCode);
//查整个城市的网格
List<CustomerGridForStangerResultDTO> selectGridByCityLike(@Param("areaCode")String areaCode);
/**
* @Description 查特定区的网格
* @Param areaCode
* @return CustomerGridForStrangerResultDTO
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectGridByAreaCode(@Param("areaCode")String areaCode);
//指定区时查询当前城市下除该区之外其余的网格
List<CustomerGridForStangerResultDTO> selectRestGridWithoutGivenAreaCode(@Param("areaCode")String areaCode , @Param("cityCode")String cityCode);
/**
* @Description 查整个城市的网格
* @Param areaCode
* @return CustomerGridForStrangerResultDTO
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectGridByCityLike(@Param("areaCode")String areaCode);
/**
* @Description 指定区时查询当前城市下除该区之外其余的网格
* @Param areaCode
* @Param cityCode
* @return CustomerGridForStrangerResultDTO
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectRestGridWithoutGivenAreaCode(@Param("areaCode")String areaCode , @Param("cityCode")String cityCode);
}

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

@ -21,7 +21,8 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.entity.CustomerGridEntity;
import java.util.List;
@ -98,7 +99,10 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
/**
* 陌生人查询附近网格数据
* 不管传递的areaCode是市级还是县级都查询整个城市的网格信息需要特定的排序
*
* @param
* @return Result<List<CustomerGridForStrangerResultDTO>>
* @author wangc
* @date 2020-03-16
* */
Result<List<CustomerGridForStangerResultDTO>> ListGridForStrangerByOrder(String areaCode, Integer PageNo, Integer pageSize);
Result<List<CustomerGridForStrangerResultDTO>> listGridForStrangerByOrder(ListCustomerGridFormDTO listCustomerGridFormDTO);
}

33
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -27,9 +27,10 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.entity.CustomerGridEntity;
import com.epmet.exception.ModuleErrorCode;
import com.epmet.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService;
import com.github.pagehelper.PageHelper;
@ -107,28 +108,18 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
}
@Override
public Result<List<CustomerGridForStangerResultDTO>> ListGridForStrangerByOrder(String areaCode, Integer pageNo, Integer pageSize) {
public Result<List<CustomerGridForStrangerResultDTO>> listGridForStrangerByOrder(ListCustomerGridFormDTO listCustomerGridFormDTO) {
//判断areaCode是市级还是县级
if(StringUtils.isBlank(areaCode)){
throw new RenException(ModuleErrorCode.ARGS_NOT_ALLOW_NULL_ERROR,"地区码不能为空!");
}
if(areaCode.length() != 6){
throw new RenException(ModuleErrorCode.NOT_STANDARD_AREA_CODE_ERROR,"无法识别的地区码!");
}
if(null == pageNo){
throw new RenException(ModuleErrorCode.ARGS_NOT_ALLOW_NULL_ERROR,"页码不能为空!");
}
if(null == pageSize || pageSize <= 0 || pageSize >=100){
pageSize = 20;
}
Result<List<CustomerGridForStrangerResultDTO>> result = new Result<>();
Result<List<CustomerGridForStangerResultDTO>> result = new Result<>();
String areaCode = listCustomerGridFormDTO.getAreaCode();
Integer pageNo = listCustomerGridFormDTO.getPageNo();
Integer pageSize = listCustomerGridFormDTO.getPageSize();
if(areaCode.endsWith("00")){
//城市 - 查全部
PageHelper.startPage(pageNo,pageSize);
List<CustomerGridForStangerResultDTO> gridList
List<CustomerGridForStrangerResultDTO> gridList
= baseDao.selectGridByCityLike(areaCode.substring(0,areaCode.length()-2));
result.setData(gridList);
@ -136,11 +127,11 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
return result;
}else{
//行政区
List<CustomerGridForStangerResultDTO> gridListArea
List<CustomerGridForStrangerResultDTO> gridListArea
= baseDao.selectGridByAreaCode(areaCode);
List<CustomerGridForStangerResultDTO> restGridListArea
List<CustomerGridForStrangerResultDTO> restGridListArea
= baseDao.selectRestGridWithoutGivenAreaCode(areaCode,areaCode.substring(0,areaCode.length()-2));
for(CustomerGridForStangerResultDTO obj : restGridListArea){
for(CustomerGridForStrangerResultDTO obj : restGridListArea){
gridListArea.add(obj);
}

60
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -23,36 +23,52 @@
</resultMap>
<!-- 根据区县地区码匹配到当前区县下所有网格 -->
<select id="selectGridByAreaCode" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStangerResultDTO">
SELECT id AS grid_id , customer_id , grid_name
FROM CUSTOMER_GRID
WHERE AREA_CODE = #{areaCode}
<select id="selectGridByAreaCode" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStrangerResultDTO">
SELECT
id AS grid_id,
customer_id,
grid_name
FROM
CUSTOMER_GRID
WHERE
AREA_CODE = #{areaCode}
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
customer_id,
CONVERT ( grid_name USING gbk ) ASC
</select>
<!-- 根据城市地区码前四位匹配到城市下所有网格 -->
<select id="selectGridByCityLike" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStangerResultDTO">
SELECT id AS grid_id , customer_id , grid_name
FROM CUSTOMER_GRID
WHERE AREA_CODE LIKE CONCAT(#{areaCode},'%')
<select id="selectGridByCityLike" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStrangerResultDTO">
SELECT
id AS grid_id,
customer_id,
grid_name
FROM
CUSTOMER_GRID
WHERE
AREA_CODE LIKE CONCAT(#{areaCode},'%')
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
customer_id,
CONVERT ( grid_name USING gbk ) ASC
</select>
<!-- 根据区县地区码匹配到所属城市下除该区县以外其余所有网格 -->
<select id="selectRestGridWithoutGivenAreaCode" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStangerResultDTO">
SELECT id AS grid_id , customer_id , grid_name
FROM CUSTOMER_GRID
WHERE AREA_CODE LIKE CONCAT(#{cityCode},'%')
AND
<![CDATA[
AREA_CODE <> #{areaCode}
]]>
<select id="selectRestGridWithoutGivenAreaCode" parameterType="java.lang.String" resultType="com.epmet.dto.result.CustomerGridForStrangerResultDTO">
SELECT
id AS grid_id,
customer_id,
grid_name
FROM
CUSTOMER_GRID
WHERE
AREA_CODE LIKE CONCAT(#{cityCode},'%')
AND <![CDATA[ AREA_CODE <> #{areaCode}
]]>
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
customer_id,
CONVERT ( grid_name USING gbk ) ASC
</select>
</mapper>

61
epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/form/CustomerGridListFormDTO.java

@ -0,0 +1,61 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description
* @ClassName CustomerGridListFormDTO
* @Author wangc
* @date 2020.03.19 14:19
*/
@Data
public class CustomerGridListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当前页
* */
@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;
}

26
epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/result/CustomerGridListResultDTO.java

@ -1,26 +0,0 @@
package com.epmet.dto.result;/**
* Created by 11 on 2020/3/17.
*/
import java.io.Serializable;
/**
* @Description
* @ClassName CustomerGridListResultDTO
* @Author wangc
* @date 2020.03.17 13:56
*/
public class CustomerGridListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
//网格Id epmet_gov_org.customer_gird.id
private String gridId;
//客户Id epmet_gov_org.customer_gird.customer_id
private String customerId;
//网格名称 epmet_gov_org.customer_gird.grid_name
private String gridName;
}

37
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerAccessRecordController.java

@ -2,8 +2,8 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.dto.form.CustomerGridListFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.service.StrangerAccessRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description
* @Description 陌生人导览模块
* @ClassName StrangerAccessRecordController
* @Author wangc
* @date 2020.03.17 11:33
@ -28,26 +28,33 @@ public class StrangerAccessRecordController {
/**
* 陌生访客授权位置获取附近网格数据
*
* */
* @Description 陌生访客根据自动定位获取附近网格数据
* @Param CustomerGridListFormDTO
* @return Result<List<CustomerGridForStrangerResultDTO>>
* @Author wangc
* @Date 2020.03.19 14:13
**/
@PostMapping("getlocationcustomergridlist")
Result<List<CustomerGridForStangerResultDTO>> getLocationCustomerGridList(@RequestBody CustomerGridListQueryDTO customerGridListQueryDTO){
Result<List<CustomerGridForStrangerResultDTO>> getLocationCustomerGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){
ValidatorUtils.validateEntity(customerGridListQueryDTO);
ValidatorUtils.validateEntity(customerGridListFormDTO);
return new Result<List<CustomerGridForStangerResultDTO>>().ok(strangerAccessRecordService.ListCustomerGrid(customerGridListQueryDTO));
return strangerAccessRecordService.listCustomerGrid(customerGridListFormDTO);
}
/**
* 陌生访客自动选定位置获取附近网格数据
*
* */
* @Description 陌生访客手动选定位置获取附近网格数据
* @Param CustomerGridListFormDTO
* @return Result<List<CustomerGridForStrangerResultDTO>>
* @Author wangc
* @Date 2020.03.19 14:13
**/
@PostMapping("getselectcdcustomergridlist")
Result<List<CustomerGridForStangerResultDTO>> getSelectcdCustomerGridList(@RequestBody CustomerGridListQueryDTO customerGridListQueryDTO){
Result<List<CustomerGridForStrangerResultDTO>> getSelectcdCustomerGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){
ValidatorUtils.validateEntity(customerGridListQueryDTO);
ValidatorUtils.validateEntity(customerGridListFormDTO);
return new Result<List<CustomerGridForStangerResultDTO>>().ok(strangerAccessRecordService.ListCustomerGrid(customerGridListQueryDTO));
return strangerAccessRecordService.listCustomerGrid(customerGridListFormDTO);
}
}

9
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java

@ -63,10 +63,19 @@ public class StrangerAccessRecordEntity extends BaseEpmetEntity {
*/
private Date visitTime;
/**
* 省份
* */
private String province;
/**
* 城市
* */
private String city;
/**
* 地区
* */
private String area;
}

24
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -2,27 +2,25 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.feign.impl.GovOrgFeginFallBack;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.feign.fallback.GovOrgFeignFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* Feign调用gov-org-server模块
* Created by 11 on 2020/3/17.
* @Description Feign调用gov-org-server模块下的CustomerGirdController
* @ClassName GovOrgFeginFallBack
* @Author wangc
* @date 2020.03.17 14:29
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeginFallBack.class, url="http://localhost:8092")
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignFallBack.class, url = "http://localhost:8092")
public interface GovOrgFeignClient {
/**
@ -31,8 +29,8 @@ public interface GovOrgFeignClient {
* @Param pageNo 当前页
* @Param pageSize 每页数据量
* */
@GetMapping("/gov/org/customergrid/queryListForStrangerByOrder")
Result<List<CustomerGridForStangerResultDTO>> getPageForStrangerGuideInterface(@RequestParam("areaCode")String areaCode, @RequestParam("pageNo")Integer pageNo, @RequestParam("pageSize")Integer pageSize);
@PostMapping("/gov/org/customergrid/queryListForStrangerByOrder")
Result<List<CustomerGridForStrangerResultDTO>> getPageForStrangerGuideInterface(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO);

32
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignFallBack.java

@ -0,0 +1,32 @@
package com.epmet.feign.fallback;
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.result.CustomerGridForStrangerResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description Feign
* @ClassName GovOrgFeginFallBack
* @Author wangc
* @date 2020.03.17 14:29
*/
@Component
public class GovOrgFeignFallBack implements GovOrgFeignClient {
/**
* 根据地区编码获取附近网格数据
* @Param ListCustomerGridFormDTO 包含地区编码页码每页数据量
* @return Result<List<CustomerGridForStrangerResultDTO>>
* */
@Override
public Result<List<CustomerGridForStrangerResultDTO>> getPageForStrangerGuideInterface(ListCustomerGridFormDTO listCustomerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListForStrangerByOrder",listCustomerGridFormDTO);
}
}

34
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/impl/GovOrgFeginFallBack.java

@ -1,34 +0,0 @@
package com.epmet.feign.impl;/**
* Created by 11 on 2020/3/17.
*/
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.result.CustomerGridForStangerResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description
* @ClassName GovOrgFeginFallBack
* @Author wangc
* @date 2020.03.17 14:29
*/
@Component
public class GovOrgFeginFallBack implements GovOrgFeignClient {
/**
* 根据地区编码获取附近网格数据
* @Param areaCode 地区编码
* @Param pageNo 当前页
* @Param pageSize 每页数据量
* */
@Override
public Result<List<CustomerGridForStangerResultDTO>> getPageForStrangerGuideInterface(String areaCode, Integer pageNo, Integer pageSize) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListForStrangerByOrder",areaCode,pageNo,pageSize);
}
}

21
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java

@ -1,21 +1,28 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerGridListFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.entity.StrangerAccessRecordEntity;
import java.util.List;
/**
* Created by 11 on 2020/3/17.
* @Description 陌生人记录访问表
* @InterfaceName ResiGuideServiceImpl
* @Author wangc
* @date 2020.03.17 13:01
*/
public interface StrangerAccessRecordService extends BaseService<StrangerAccessRecordEntity> {
/**
*
* 陌生人根据位置码获取附近网格数据并且插入陌生人访客记录
* */
List<CustomerGridForStangerResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO);
* @Description 陌生人根据地区编码查询附近网格数据接口定义
* @Param CustomerGridListFormDTO
* @return Result<List<CustomerGridForStrangerResultDTO>>
* @Author wangc
* @Date 2020.03.19 14:28
**/
Result<List<CustomerGridForStrangerResultDTO>> listCustomerGrid(CustomerGridListFormDTO customerGridListFormDTO);
}

74
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java

@ -5,20 +5,21 @@ package com.epmet.service.impl;/**
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.StrangerAccessRecordDao;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.dto.form.CustomerGridListFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.entity.StrangerAccessRecordEntity;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.StrangerAccessRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Description
* @Description 陌生人记录访问表
* @ClassName ResiGuideServiceImpl
* @Author wangc
* @date 2020.03.17 13:01
@ -29,48 +30,61 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
@Autowired
private GovOrgFeignClient govOrgFeignClient;
/**
*
* 陌生人根据位置码获取附近网格数据并且插入陌生人访客记录
* */
* @Description 陌生人根据地区编码查询附近网格数据具体实现
* @Param CustomerGridListFormDTO
* @return Result<List<CustomerGridForStrangerResultDTO>>
* @Author wangc
* @Date 2020.03.19 14:28
**/
@Override
public List<CustomerGridForStangerResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO) {
public Result<List<CustomerGridForStrangerResultDTO>> listCustomerGrid(CustomerGridListFormDTO customerGridListFormDTO) {
ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO();
listCustomerGridFormDTO.setAreaCode(0 == customerGridListFormDTO.getIsAuthorized() ?
customerGridListFormDTO.getSelectedAreaCode() : customerGridListFormDTO.getAreaCode());
Result<List<CustomerGridForStangerResultDTO>> queryResult =
listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? 1 : customerGridListFormDTO.getPageNo());
listCustomerGridFormDTO.setPageSize(customerGridListFormDTO.getPageSize());
Result<List<CustomerGridForStrangerResultDTO>> queryResult =
govOrgFeignClient
.getPageForStrangerGuideInterface(customerGridListQueryDTO.getAreaCode(),customerGridListQueryDTO.getPageNo(),customerGridListQueryDTO.getPageSize());
if(0 == queryResult.getCode()) {
.getPageForStrangerGuideInterface(listCustomerGridFormDTO);
//Feign调用成功
if(queryResult.success()) {
List<CustomerGridForStangerResultDTO> queryList = queryResult.getData();
List<CustomerGridForStrangerResultDTO> queryList = queryResult.getData();
if (null != queryResult && queryList.size() > 0) {
StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity();
//未授权,手动选择 locationAreaCode
if (0 == customerGridListQueryDTO.getIsAuthorized()) {
strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getSelectedAreaCode());
} else if (1 == customerGridListQueryDTO.getIsAuthorized()) {
//已授权,自动选择 selectedAreaCode
strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getAreaCode());
//未授权,手动选择
if (0 == customerGridListFormDTO.getIsAuthorized()) {
strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode());
} else if (1 == customerGridListFormDTO.getIsAuthorized()) {
//已授权,自动选择
strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode());
}
strangerTrance.setIsAuthorized(customerGridListQueryDTO.getIsAuthorized());
strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized());
strangerTrance.setGridNumber(queryList.size());
strangerTrance.setVisitTime(new Date());
strangerTrance.setDelFlag("1");
strangerTrance.setRevision(0);
strangerTrance.setCreatedBy("陌生人访客");
strangerTrance.setCreatedTime(new Date());
strangerTrance.setProvince(customerGridListQueryDTO.getProvince());
strangerTrance.setCity(customerGridListQueryDTO.getCity());
strangerTrance.setArea(customerGridListQueryDTO.getArea());
strangerTrance.setProvince(customerGridListFormDTO.getProvince());
strangerTrance.setCity(customerGridListFormDTO.getCity());
strangerTrance.setArea(customerGridListFormDTO.getArea());
insert(strangerTrance);
return queryList;
return new Result<List<CustomerGridForStrangerResultDTO>>().ok(queryList);
} else {
return null;
//没有查询出结果
return new Result<List<CustomerGridForStrangerResultDTO>>().ok(new ArrayList<>());
}
}else{
return null;
//Feign调用失败
return new Result<List<CustomerGridForStrangerResultDTO>>().error(queryResult.getCode(),queryResult.getMsg());
}

Loading…
Cancel
Save