Browse Source

修改接口:根据位置授权/不授权选定附近网格信息,加注释,加数据校验

dev
wangchao 6 years ago
parent
commit
622a4de1ff
  1. 4
      epmet-gateway/pom.xml
  2. 5
      epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java
  3. 25
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStangerResultDTO.java
  4. 5
      epmet-module/gov-org/gov-org-server/pom.xml
  5. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  6. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  7. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/exception/ModuleErrorCode.java
  8. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  9. 53
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  10. 32
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  11. 47
      epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/CustomerGridListQueryDTO.java
  12. 5
      epmet-module/resi-guide/resi-guide-server/pom.xml
  13. 48
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/ResiGuideController.java
  14. 53
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerAccessRecordController.java
  15. 8
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/entity/StrangerAccessRecordEntity.java
  16. 25
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  17. 19
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/impl/GovOrgFeginFallBack.java
  18. 18
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/ResiGuideService.java
  19. 21
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java
  20. 70
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/ResiGuideServiceImpl.java
  21. 80
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java
  22. 5
      epmet-module/resi-guide/resi-guide-server/src/main/resources/mapper/StrangerAccessRecordDao.xml

4
epmet-gateway/pom.xml

@ -130,7 +130,7 @@
<!-- <gateway.routes.oper-crm-server.uri>lb://oper-crm-server</gateway.routes.oper-crm-server.uri>-->
<gateway.routes.oper-crm-server.uri>http://localhost:8090</gateway.routes.oper-crm-server.uri>
<!-- 12、居民端陌生人导览 -->
<!-- <gateway.routes.resi-guide-server.uri>lb://oper-crm-server</gateway.routes.resi-guide-server.uri>-->
<!-- <gateway.routes.resi-guide-server.uri>lb://resi-guide-server</gateway.routes.resi-guide-server.uri>-->
<gateway.routes.resi-guide-server.uri>http://localhost:8091</gateway.routes.resi-guide-server.uri>
<!-- 13、政府组织管理 -->
<!-- <gateway.routes.gov-org-server.uri>lb://gov-org-server</gateway.routes.gov-org-server.uri>-->
@ -183,7 +183,7 @@
<!-- 11、运营端客户定制化服务 -->
<gateway.routes.oper-crm-server.uri>lb://oper-crm-server</gateway.routes.oper-crm-server.uri>
<!-- 12、居民端陌生人导览 -->
<gateway.routes.resi-guide-server.uri>lb://resi-guid-server</gateway.routes.resi-guide-server.uri>
<gateway.routes.resi-guide-server.uri>lb://resi-guide-server</gateway.routes.resi-guide-server.uri>
<!-- 13、政府组织管理 -->
<gateway.routes.gov-org-server.uri>lb://gov-org-server</gateway.routes.gov-org-server.uri>
</properties>

5
epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java

@ -155,9 +155,4 @@ public class DemoController {
return demoService.saveCustomerInfo(dto);
}
@PostMapping("/testDemoToGov")
public String testDemoToGov(){
return demoService.testDemo2Gov();
}
}

25
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridForStangerResultDTO.java

@ -2,11 +2,32 @@ package com.epmet.dto.result;/**
* Created by 11 on 2020/3/19.
*/
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Description 陌生人搜索网格返回结果
* @ClassName CustomerGridForStangerResultDTO
* @Author wangc
* @date 2020.03.19 00:38
*/
public class CustomerGridForStangerResultDTO {
@Data
public class CustomerGridForStangerResultDTO implements Serializable {
private static final long serialVersionUID = -1L;
/**
* 网格ID
* */
private String gridId;
/**
* 客户ID
* */
private String customerId;
/**
* 网格名称
* */
private String gridName;
}

5
epmet-module/gov-org/gov-org-server/pom.xml

@ -54,6 +54,11 @@
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>
<build>

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

@ -26,6 +26,7 @@ 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.excel.CustomerGridExcel;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
@ -61,7 +62,7 @@ public class CustomerGridController {
return new Result<CustomerGridDTO>().ok(data);
}
@PostMapping
@PostMapping("save")
public Result save(@RequestBody CustomerGridDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -91,9 +92,11 @@ public class CustomerGridController {
ExcelUtils.exportExcelToTarget(response, null, list, CustomerGridExcel.class);
}
@GetMapping("{areaCode}")
public Result queryListByOrder(@PathVariable("areaCode")String areaCode){
return new Result();
@GetMapping("queryListForStrangerByOrder")
public Result<List<CustomerGridForStangerResultDTO>> queryListForStrangerByOrder(@RequestParam("areaCode")String areaCode, @RequestParam("pageNo") Integer pageNo, Integer pageSize){
return customerGridService.ListGridForStrangerByOrder(areaCode, pageNo, pageSize);
}
}

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

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.entity.CustomerGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户网格表
@ -29,5 +33,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
//查特定区的网格
List<CustomerGridForStangerResultDTO> selectGridByAreaCode(@Param("areaCode")String areaCode);
//查整个城市的网格
List<CustomerGridForStangerResultDTO> selectGridByCityLike(@Param("areaCode")String areaCode);
//指定区时查询当前城市下除该区之外其余的网格
List<CustomerGridForStangerResultDTO> selectRestGridWithoutGivenAreaCode(@Param("areaCode")String areaCode , @Param("cityCode")String cityCode);
}

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/exception/ModuleErrorCode.java

@ -1,7 +1,20 @@
package com.epmet.exception;
import com.epmet.commons.tools.exception.ErrorCode;
/**
* Created by 11 on 2020/3/19.
* 模块错误编码由9位数字组成前6位为模块编码后3位为业务编码
* <p>
* 100001001100001代表模块001代表业务代码
* </p>
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public interface ModuleErrorCode {
public interface ModuleErrorCode extends ErrorCode {
int ARGS_NOT_ALLOW_NULL_ERROR = 100019001;
int NOT_STANDARD_AREA_CODE_ERROR = 100019002;
}

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

@ -19,7 +19,9 @@ package com.epmet.service;
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.entity.CustomerGridEntity;
import java.util.List;
@ -92,4 +94,11 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @date 2020-03-16
*/
void delete(String[] ids);
/**
* 陌生人查询附近网格数据
* 不管传递的areaCode是市级还是县级都查询整个城市的网格信息需要特定的排序
*
* */
Result<List<CustomerGridForStangerResultDTO>> ListGridForStrangerByOrder(String areaCode, Integer PageNo, Integer pageSize);
}

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

@ -20,14 +20,19 @@ package com.epmet.service.impl;
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.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
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.entity.CustomerGridEntity;
import com.epmet.exception.ModuleErrorCode;
import com.epmet.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -101,4 +106,52 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public Result<List<CustomerGridForStangerResultDTO>> ListGridForStrangerByOrder(String areaCode, Integer pageNo, Integer pageSize) {
//判断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<CustomerGridForStangerResultDTO>> result = new Result<>();
if(areaCode.endsWith("00")){
//城市 - 查全部
PageHelper.startPage(pageNo,pageSize);
List<CustomerGridForStangerResultDTO> gridList
= baseDao.selectGridByCityLike(areaCode.substring(0,areaCode.length()-2));
result.setData(gridList);
result.setCode(0);
return result;
}else{
//行政区
List<CustomerGridForStangerResultDTO> gridListArea
= baseDao.selectGridByAreaCode(areaCode);
List<CustomerGridForStangerResultDTO> restGridListArea
= baseDao.selectRestGridWithoutGivenAreaCode(areaCode,areaCode.substring(0,areaCode.length()-2));
for(CustomerGridForStangerResultDTO obj : restGridListArea){
gridListArea.add(obj);
}
//分页操作
result.setData(gridListArea);
result.setCode(0);
return result;
}
}
}

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

@ -22,5 +22,37 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</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}
ORDER BY
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},'%')
ORDER BY
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}
]]>
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
</select>
</mapper>

47
epmet-module/resi-guide/resi-guide-client/src/main/java/com/epmet/dto/CustomerGridListQueryDTO.java

@ -4,6 +4,8 @@ package com.epmet.dto;/**
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -17,21 +19,46 @@ public class CustomerGridListQueryDTO implements Serializable {
private static final long serialVersionUID = 1L;
//token信息
private String token;
//期望分页页码
/**
* 当前页
* */
@Min(value = 1)
private Integer pageNo;
//每页数据量(默认20)
private Integer pageSize;
/**
* 每页数量
* */
private Integer pageSize = 20;
/**
* 地区码
* */
private String areaCode;
/**
* 选定地区编码
* */
private String selectedAreaCode;
private String lelectedAreaCode;
//是否首次位置授权(0:是 1:否)
/**
* 是否首次位置授权(0: 1:)
*/
private Integer isAuthorized;
/**
* 前端传递的省份
* */
@NotBlank(message = "省份信息不能为空")
private String province;
/**
* 前端传递的城市
* */
@NotBlank(message = "城市信息不能为空")
private String city;
/**
* 前端传递的地区
* */
private String area;
}

5
epmet-module/resi-guide/resi-guide-server/pom.xml

@ -58,6 +58,11 @@
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-org-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>

48
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/ResiGuideController.java

@ -1,48 +0,0 @@
package com.epmet.controller;/**
* Created by 11 on 2020/3/17.
*/
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.service.ResiGuideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description
* @ClassName ResiGuideController
* @Author wangc
* @date 2020.03.17 11:33
*/
@RestController
@RequestMapping("stranger")
public class ResiGuideController {
@Autowired
private ResiGuideService resiGuideService;
@PostMapping("getlocationcustomergridlist")
Result<PageData<CustomerGridListResultDTO>> getlocationcustomergridlist(@RequestBody CustomerGridListQueryDTO queryParam){
Result<PageData<CustomerGridListResultDTO>> result = new Result<>();
//TODO..捕获异常
return result.ok(resiGuideService.ListCustomerGrid(queryParam));
}
@PostMapping("getlelectcdcustomergridlist")
Result<PageData<CustomerGridListResultDTO>> getlelectcdcustomergridlist(@RequestBody CustomerGridListQueryDTO queryParam){
Result<PageData<CustomerGridListResultDTO>> result = new Result<>();
//TODO..捕获异常
return result.ok(resiGuideService.ListCustomerGrid(queryParam));
}
}

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

@ -0,0 +1,53 @@
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.service.StrangerAccessRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description
* @ClassName StrangerAccessRecordController
* @Author wangc
* @date 2020.03.17 11:33
*/
@RestController
@RequestMapping("stranger")
public class StrangerAccessRecordController {
@Autowired
private StrangerAccessRecordService strangerAccessRecordService;
/**
* 陌生访客授权位置获取附近网格数据
*
* */
@PostMapping("getlocationcustomergridlist")
Result<List<CustomerGridForStangerResultDTO>> getLocationCustomerGridList(@RequestBody CustomerGridListQueryDTO customerGridListQueryDTO){
ValidatorUtils.validateEntity(customerGridListQueryDTO);
return new Result<List<CustomerGridForStangerResultDTO>>().ok(strangerAccessRecordService.ListCustomerGrid(customerGridListQueryDTO));
}
/**
* 陌生访客自动选定位置获取附近网格数据
*
* */
@PostMapping("getselectcdcustomergridlist")
Result<List<CustomerGridForStangerResultDTO>> getSelectcdCustomerGridList(@RequestBody CustomerGridListQueryDTO customerGridListQueryDTO){
ValidatorUtils.validateEntity(customerGridListQueryDTO);
return new Result<List<CustomerGridForStangerResultDTO>>().ok(strangerAccessRecordService.ListCustomerGrid(customerGridListQueryDTO));
}
}

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

@ -46,7 +46,7 @@ public class StrangerAccessRecordEntity extends BaseEpmetEntity {
/**
* 选择地区编码 (用户选择地区位置
*/
private String lelectedAreaCode;
private String selectedAreaCode;
/**
* 是否首次位置授权(0: 1:)
@ -63,4 +63,10 @@ public class StrangerAccessRecordEntity extends BaseEpmetEntity {
*/
private Date visitTime;
private String province;
private String city;
private String area;
}

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

@ -4,19 +4,38 @@ 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 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.RequestParam;
import java.util.List;
/**
* Feign调用gov-org-server模块
* Created by 11 on 2020/3/17.
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeginFallBack.class)
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeginFallBack.class, url="http://localhost:8092")
public interface GovOrgFeignClient {
@PostMapping(value = "/gov/org/customergrid/{areaCode}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<PageData<CustomerGridListResultDTO>> getPageForStrangerGuideInterface(@PathVariable("areaCode")String areaCode);
/**
* 根据地区编码获取附近网格数据
* @Param areaCode 地区编码
* @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);
}

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

@ -3,14 +3,14 @@ package com.epmet.feign.impl;/**
*/
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.dto.result.CustomerGridForStangerResultDTO;
import com.epmet.feign.GovOrgFeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import java.util.List;
/**
* @Description
@ -21,9 +21,14 @@ import org.springframework.stereotype.Controller;
@Component
public class GovOrgFeginFallBack implements GovOrgFeignClient {
/**
* 根据地区编码获取附近网格数据
* @Param areaCode 地区编码
* @Param pageNo 当前页
* @Param pageSize 每页数据量
* */
@Override
public Result<PageData<CustomerGridListResultDTO>> getPageForStrangerGuideInterface(String areaCode) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListByAreaCodeOrderBy",areaCode);
public Result<List<CustomerGridForStangerResultDTO>> getPageForStrangerGuideInterface(String areaCode, Integer pageNo, Integer pageSize) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListForStrangerByOrder",areaCode,pageNo,pageSize);
}
}

18
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/ResiGuideService.java

@ -1,18 +0,0 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.entity.StrangerAccessRecordEntity;
/**
* Created by 11 on 2020/3/17.
*/
public interface ResiGuideService extends BaseService<StrangerAccessRecordEntity> {
PageData<CustomerGridListResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO);
void save(StrangerAccessRecordEntity strangerAccessRecordEntity);
}

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

@ -0,0 +1,21 @@
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.entity.StrangerAccessRecordEntity;
import java.util.List;
/**
* Created by 11 on 2020/3/17.
*/
public interface StrangerAccessRecordService extends BaseService<StrangerAccessRecordEntity> {
/**
*
* 陌生人根据位置码获取附近网格数据并且插入陌生人访客记录
* */
List<CustomerGridForStangerResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO);
}

70
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/ResiGuideServiceImpl.java

@ -1,70 +0,0 @@
package com.epmet.service.impl;/**
* Created by 11 on 2020/3/17.
*/
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.StrangerAccessRecordDao;
import com.epmet.dto.CustomerGridListQueryDTO;
import com.epmet.dto.result.CustomerGridListResultDTO;
import com.epmet.entity.StrangerAccessRecordEntity;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.ResiGuideService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* @Description
* @ClassName ResiGuideServiceImpl
* @Author wangc
* @date 2020.03.17 13:01
*/
@Service
public class ResiGuideServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements ResiGuideService {
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Override
public PageData<CustomerGridListResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO) {
PageData<CustomerGridListResultDTO> queryResult =
govOrgFeignClient.getPageForStrangerGuideInterface(customerGridListQueryDTO);
if(null != queryResult.getList() && queryResult.getList().size() > 0){
for(CustomerGridListResultDTO obj : queryResult.getList()){
StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity();
//未授权,手动选择 locationAreaCode
if(0 == customerGridListQueryDTO.getIsAuthorized()){
strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getLelectedAreaCode());
}else if( 1 == customerGridListQueryDTO.getIsAuthorized()){
//已授权,自动选择 lelectedAreaCode
strangerTrance.setLocationAreaCode(customerGridListQueryDTO.getAreaCode());
}
strangerTrance.setIsAuthorized(customerGridListQueryDTO.getIsAuthorized());
strangerTrance.setGridNumber(queryResult.getTotal());
strangerTrance.setVisitTime(new Date());
strangerTrance.setDelFlag("1");
strangerTrance.setRevision(0);
strangerTrance.setCreatedBy("陌生人访客");
strangerTrance.setCreatedTime(new Date());
insert(strangerTrance);
}
}
return queryResult;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(StrangerAccessRecordEntity strangerAccessRecordEntity) {
StrangerAccessRecordEntity entity = ConvertUtils.sourceToTarget(strangerAccessRecordEntity, StrangerAccessRecordEntity.class);
insert(entity);
}
}

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

@ -0,0 +1,80 @@
package com.epmet.service.impl;/**
* Created by 11 on 2020/3/17.
*/
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.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.Date;
import java.util.List;
/**
* @Description
* @ClassName ResiGuideServiceImpl
* @Author wangc
* @date 2020.03.17 13:01
*/
@Service
public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements StrangerAccessRecordService {
@Autowired
private GovOrgFeignClient govOrgFeignClient;
/**
*
* 陌生人根据位置码获取附近网格数据并且插入陌生人访客记录
* */
@Override
public List<CustomerGridForStangerResultDTO> ListCustomerGrid(CustomerGridListQueryDTO customerGridListQueryDTO) {
Result<List<CustomerGridForStangerResultDTO>> queryResult =
govOrgFeignClient
.getPageForStrangerGuideInterface(customerGridListQueryDTO.getAreaCode(),customerGridListQueryDTO.getPageNo(),customerGridListQueryDTO.getPageSize());
if(0 == queryResult.getCode()) {
List<CustomerGridForStangerResultDTO> 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());
}
strangerTrance.setIsAuthorized(customerGridListQueryDTO.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());
insert(strangerTrance);
return queryList;
} else {
return null;
}
}else{
return null;
}
}
}

5
epmet-module/resi-guide/resi-guide-server/src/main/resources/mapper/StrangerAccessRecordDao.xml

@ -6,7 +6,7 @@
<resultMap type="com.epmet.entity.StrangerAccessRecordEntity" id="strangerAccessRecordMap">
<result property="id" column="ID"/>
<result property="locationAreaCode" column="LOCATION_AREA_CODE"/>
<result property="lelectedAreaCode" column="LELECTED_AREA_CODE"/>
<result property="selectedAreaCode" column="SELECTED_AREA_CODE"/>
<result property="isAuthorized" column="IS_AUTHORIZED"/>
<result property="gridNumber" column="GRID_NUMBER"/>
<result property="visitTime" column="VISIT_TIME"/>
@ -16,6 +16,9 @@
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="province" column="PROVINCE" />
<result property="city" column="CITY" />
<result property="area" column="AREA" />
</resultMap>

Loading…
Cancel
Save