Browse Source

Merge branches 'dev1.0' and 'dev1.0-opercustomize' of http://121.42.41.42:7070/r/epmet-cloud into dev1.0-opercustomize

master
yinzuomei 6 years ago
parent
commit
43f2b0f5c1
  1. 2
      epmet-admin/epmet-admin-server/pom.xml
  2. 2
      epmet-auth/pom.xml
  3. 2
      epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  4. 8
      epmet-gateway/pom.xml
  5. 11
      epmet-gateway/src/main/resources/bootstrap.yml
  6. 2
      epmet-module/epmet-activiti/epmet-activiti-server/pom.xml
  7. 2
      epmet-module/epmet-demo/epmet-demo-server/pom.xml
  8. 2
      epmet-module/epmet-job/epmet-job-server/pom.xml
  9. 2
      epmet-module/epmet-message/epmet-message-server/pom.xml
  10. 2
      epmet-module/epmet-oss/epmet-oss-server/pom.xml
  11. 2
      epmet-module/gov-org/gov-org-server/pom.xml
  12. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  13. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  14. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  15. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  16. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java
  17. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  18. 10
      epmet-module/oper-access/oper-access-server/pom.xml
  19. 2
      epmet-module/oper-crm/oper-crm-server/pom.xml
  20. 2
      epmet-module/oper-customize/oper-customize-server/pom.xml
  21. 1
      epmet-module/pom.xml
  22. 2
      epmet-module/resi-guide/resi-guide-server/pom.xml
  23. 25
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/constant/StrangerResiGuideConstant.java
  24. 4
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java
  25. 4
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  26. 6
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  27. 4
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  28. 4
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignFallBack.java
  29. 7
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/StrangerAccessRecordService.java
  30. 101
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java
  31. 8
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/utils/ModuleConstant.java
  32. 21
      epmet-module/resi-mine/pom.xml
  33. 35
      epmet-module/resi-mine/resi-mine-client/pom.xml
  34. 0
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/form/.gitkeep
  35. 0
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/.gitkeep
  36. 154
      epmet-module/resi-mine/resi-mine-server/pom.xml
  37. 31
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/ResiMineApplication.java
  38. 26
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/config/ModuleConfigImpl.java
  39. 68
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/config/SwaggerConfig.java
  40. 35
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/controller/ResiMineGridController.java
  41. 0
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/dao/.gitkeep
  42. 0
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/entity/.gitkeep
  43. 0
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/excel/.gitkeep
  44. 25
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/exception/ModuleErrorCode.java
  45. 27
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  46. 29
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  47. 21
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/service/ResiMineGridService.java
  48. 42
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/service/impl/ResiMineGridServiceImpl.java
  49. 30
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/utils/ModuleConstant.java
  50. 106
      epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml
  51. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages.properties
  52. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages_en_US.properties
  53. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages_zh_CN.properties
  54. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages_zh_TW.properties
  55. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation.properties
  56. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation_en_US.properties
  57. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation_zh_CN.properties
  58. 1
      epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation_zh_TW.properties
  59. 159
      epmet-module/resi-mine/resi-mine-server/src/main/resources/logback-spring.xml
  60. 25
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestGridInfoResultDTO.java
  61. 2
      epmet-user/epmet-user-server/pom.xml
  62. 37
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/GridVisitedConstant.java
  63. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java
  64. 21
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java
  65. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java
  66. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java
  67. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  68. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperRoleUserFeignClient.java
  69. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
  70. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java
  71. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java
  72. 62
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java
  73. 88
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java
  74. 28
      epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml
  75. 9
      epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml

2
epmet-admin/epmet-admin-server/pom.xml

@ -99,7 +99,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-auth/pom.xml

@ -123,7 +123,7 @@
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody;
* @Author yinzuomei
* @Date 2020/3/16 14:48
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class)
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class )
public interface EpmetUserFeignClient {
/**

8
epmet-gateway/pom.xml

@ -95,9 +95,9 @@
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
@ -148,6 +148,8 @@
<gateway.routes.gov-org-server.uri>http://127.0.0.1:8092</gateway.routes.gov-org-server.uri>
<!-- 14、#运营端访问权限控制 -->
<gateway.routes.oper-access-server.uri>http://127.0.0.1:8093</gateway.routes.oper-access-server.uri>
<!-- 15、居民端个人信息 -->
<gateway.routes.resi-mine-server.uri>http://127.0.0.1:8094</gateway.routes.resi-mine-server.uri>
</properties>
</profile>
@ -201,6 +203,8 @@
<gateway.routes.gov-org-server.uri>lb://gov-org-server</gateway.routes.gov-org-server.uri>
<!-- 14、#运营端访问权限控制 -->
<gateway.routes.oper-access-server.uri>lb://oper-access-server</gateway.routes.oper-access-server.uri>
<!-- 15、居民端个人信息 -->
<gateway.routes.resi-mine-server.uri>http://resi-mine-server</gateway.routes.resi-mine-server.uri>
</properties>
</profile>
</profiles>

11
epmet-gateway/src/main/resources/bootstrap.yml

@ -147,6 +147,15 @@ spring:
filters:
- StripPrefix=1
- CpAuth=true
#居民端个人信息
- id: resi-mine-server
uri: @gateway.routes.resi-mine-server.uri@
order: 15
predicates:
- Path=${server.servlet.context-path}/resi/mine/**
filters:
- StripPrefix=1
- CpAuth=true
nacos:
discovery:
server-addr: @nacos.server-addr@
@ -183,6 +192,7 @@ renren:
- /oper/access/**
- /sys/**
- /resi/guide/**
- /resi/mine/**
management:
endpoints:
web:
@ -245,6 +255,7 @@ epmet:
- /oper/access/**
- /resi/guide/stranger/getgridhome
- /auth/login/logout
- /resi/mine/**
swaggerUrls:
jwt:

2
epmet-module/epmet-activiti/epmet-activiti-server/pom.xml

@ -175,7 +175,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-module/epmet-demo/epmet-demo-server/pom.xml

@ -115,7 +115,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-module/epmet-job/epmet-job-server/pom.xml

@ -112,7 +112,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-module/epmet-message/epmet-message-server/pom.xml

@ -135,7 +135,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-module/epmet-oss/epmet-oss-server/pom.xml

@ -143,7 +143,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

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

@ -106,7 +106,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

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

@ -102,8 +102,8 @@ public class CustomerGridController {
* @throws Exception
*/
@PostMapping("getcustomergridbygridid")
public Result<CustomerGridDTO> getCustomerGridByGridId(@RequestBody CustomerGridFormDTO formDTO) {
return customerGridService.getCustomerGridByGridId(formDTO);
public Result<CustomerGridDTO> getCustomerGridByGridId(@RequestBody CustomerGridFormDTO customerGridFormDTO) {
return customerGridService.getCustomerGridByGridId(customerGridFormDTO);
}
/**
* @Description 陌生人导览模块调用 根据陌生揽客传入的地区码进行分页查询显示
@ -112,11 +112,11 @@ public class CustomerGridController {
* @Author wangc
* @Date 2020.03.19 15:23
**/
@PostMapping("queryListForStrangerByOrder")
public Result<List<CustomerGridForStrangerResultDTO>> queryListForStrangerByOrder(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO ){
@PostMapping("querygridlistbyareacode")
public Result<List<CustomerGridForStrangerResultDTO>> queryGridListByAreaCode(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO ){
ValidatorUtils.validateEntity(listCustomerGridFormDTO);
return customerGridService.listGridForStrangerByOrder(listCustomerGridFormDTO);
return customerGridService.listGridByAreaCode(listCustomerGridFormDTO);
}
@GetMapping("getcustomergrid/{id}")

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

@ -39,14 +39,6 @@ import java.util.Map;
public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
/**
* @Description 查特定区的网格
* @Param areaCode
* @return CustomerGridForStrangerResultDTO
* @Author wangc
* @Date 2020.03.19 15:53
**/
List<CustomerGridForStrangerResultDTO> selectGridByAreaCode(@Param("areaCode")String areaCode);
/**
* @Description 查整个城市的网格
@ -68,5 +60,5 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
**/
List<CustomerGridForStrangerResultDTO> selectRestGridWithoutGivenAreaCode(Map<String,Object> paramsMap);
CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO formDTO);
CustomerGridDTO selectCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
}

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

@ -105,12 +105,12 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @author wangc
* @date 2020-03-16
* */
Result<List<CustomerGridForStrangerResultDTO>> listGridForStrangerByOrder(ListCustomerGridFormDTO listCustomerGridFormDTO);
Result<List<CustomerGridForStrangerResultDTO>> listGridByAreaCode(ListCustomerGridFormDTO listCustomerGridFormDTO);
/** 根据网格Id查询用户数据
* @param formDTO
* @param customerGridFormDTO
* @return
* @date 2020-03-17
*/
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO);
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
}

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

@ -33,6 +33,7 @@ import com.epmet.entity.CustomerGridEntity;
import com.epmet.redis.CustomerGridRedis;
import com.epmet.service.CustomerGridService;
import com.epmet.util.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -108,7 +109,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
}
@Override
public Result<List<CustomerGridForStrangerResultDTO>> listGridForStrangerByOrder(ListCustomerGridFormDTO listCustomerGridFormDTO) {
public Result<List<CustomerGridForStrangerResultDTO>> listGridByAreaCode(ListCustomerGridFormDTO listCustomerGridFormDTO) {
Result<List<CustomerGridForStrangerResultDTO>> result = new Result<>();
@ -116,17 +117,17 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
String areaCode = listCustomerGridFormDTO.getAreaCode();
listCustomerGridFormDTO.setPageNo((listCustomerGridFormDTO.getPageNo() - 1) * listCustomerGridFormDTO.getPageSize());
if(areaCode.endsWith("00")){
if(areaCode.endsWith(ModuleConstant.LAST_TWO_LETTER_OF_FORMATIVE_CITY_CODE)){
//城市 - 查全部
listCustomerGridFormDTO.setAreaCode(areaCode.substring(0,areaCode.length()-2));
List<CustomerGridForStrangerResultDTO> gridList
= baseDao.selectGridByCityLike(listCustomerGridFormDTO);
result.setData(gridList);
result.setCode(0);
result.setCode(ModuleConstant.SUCCESS_CODE_RESULT);
return result;
}else{
//行政区
//行政区 - 指定行政区在前,所属城市下其余行政区在后
Map<String,Object> map = new HashMap<>();
@ -147,8 +148,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
}
@Override
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO) {
return new Result<CustomerGridDTO>().ok(baseDao.getCustomerGridByGridId(formDTO));
}
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO) {
return new Result<CustomerGridDTO>().ok(baseDao.selectCustomerGridByGridId(customerGridFormDTO));
}
}

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java

@ -0,0 +1,16 @@
package com.epmet.util;/**
* Created by 11 on 2020/3/23.
*/
/**
* @Description
* @IntefaceName ModuleConstant
* @Author wangc
* @date 2020.03.23 18:34
*/
public interface ModuleConstant {
String LAST_TWO_LETTER_OF_FORMATIVE_CITY_CODE = "00";
int SUCCESS_CODE_RESULT = 0;
}

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

@ -22,22 +22,7 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 根据区县地区码匹配到当前区县下所有网格 -->
<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
del_flag = 0
AND
area_code = #{areaCode}
ORDER BY
customer_id,
CONVERT ( grid_name USING gbk ) ASC
</select>
<select id="getCustomerGridByGridId" parameterType="com.epmet.dto.form.CustomerGridFormDTO"
resultType="com.epmet.dto.CustomerGridDTO">
SELECT

10
epmet-module/oper-access/oper-access-server/pom.xml

@ -95,10 +95,10 @@
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<server.port>8093</server.port>
<spring.profiles.active>dev</spring.profiles.active>
</activation>
<properties>
<server.port>8093</server.port>
<spring.profiles.active>dev</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
@ -108,7 +108,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-module/oper-crm/oper-crm-server/pom.xml

@ -107,7 +107,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

2
epmet-module/oper-customize/oper-customize-server/pom.xml

@ -101,7 +101,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

1
epmet-module/pom.xml

@ -24,6 +24,7 @@
<module>resi-guide</module>
<module>gov-org</module>
<module>oper-access</module>
<module>resi-mine</module>
</modules>
</project>

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

@ -119,7 +119,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

25
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/constant/StrangerResiGuideConstant.java

@ -0,0 +1,25 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.constant;
/**
* 常量
* @author sun
* @since 1.0.0
*/
public interface StrangerResiGuideConstant {
/**
* 参数异常
*/
String PARAMETER_EXCEPTION = "参数异常,app端不是指定的居民端,请检查token信息!";
/**
* 服务调用异常
*/
String EPMET_USER_EXCEPTION = "调用epmet-user服务保存网格记录表数据失败!";
}

4
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java

@ -54,8 +54,8 @@ public class StrangerResiGuideController {
* @Date 2020/3/16
**/
@PostMapping("getgridhome")
public Result<HomeDesignByCustomerResultDTO> getValidCustomerList( @LoginUser TokenDto tokenDTO, @RequestBody StrangerFormDTO formDTO) throws Exception {
return strangerAccessRecordService.getgridhome(tokenDTO, formDTO);
public Result<HomeDesignByCustomerResultDTO> getGridHome( @LoginUser TokenDto tokenDTO, @RequestBody StrangerFormDTO strangerFormDTO) throws Exception {
return strangerAccessRecordService.getGridHome(tokenDTO, strangerFormDTO);
}

4
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -19,8 +19,8 @@ public interface EpmetUserFeignClient {
* @param
* @Description
**/
@PostMapping("/epmetuser/gridvisited/savelatestandvisited")
Result saveLatestAndVisited(VisitedFormDTO formDTO);
@PostMapping("/epmetuser/gridvisited/savevisitedrecord")
Result saveVisitedRecord(VisitedFormDTO formDTO);

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

@ -20,7 +20,7 @@ import java.util.List;
* @Author wangc
* @date 2020.03.17 14:29
*/
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignFallBack.class)
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignFallBack.class )
public interface GovOrgFeignClient {
/**
@ -29,8 +29,8 @@ public interface GovOrgFeignClient {
* @Param pageNo 当前页
* @Param pageSize 每页数据量
* */
@PostMapping("/gov/org/customergrid/queryListForStrangerByOrder")
Result<List<CustomerGridForStrangerResultDTO>> getPageForStrangerGuideInterface(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO);
@PostMapping("/gov/org/customergrid/querygridlistbyareacode")
Result<List<CustomerGridForStrangerResultDTO>> queryGridListByAreaCode(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO);

4
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -16,8 +16,8 @@ import org.springframework.stereotype.Component;
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result saveLatestAndVisited(VisitedFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveLatestAndVisited",formDTO);
public Result saveVisitedRecord(VisitedFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "savevisitedrecord",formDTO);
}

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

@ -26,7 +26,7 @@ public class GovOrgFeignFallBack implements GovOrgFeignClient {
* @return Result<List<CustomerGridForStrangerResultDTO>>
* */
@Override
public Result<List<CustomerGridForStrangerResultDTO>> getPageForStrangerGuideInterface(ListCustomerGridFormDTO listCustomerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListForStrangerByOrder",listCustomerGridFormDTO);
public Result<List<CustomerGridForStrangerResultDTO>> queryGridListByAreaCode(ListCustomerGridFormDTO listCustomerGridFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryGridListByAreaCode",listCustomerGridFormDTO);
}
}

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

@ -25,6 +25,7 @@ public interface StrangerAccessRecordService extends BaseService<StrangerAccessR
/**
* 查询陌生人访问记录
*
* @param params
* @return PageData<StrangerAccessRecordDTO>
* @author yangshaoping
@ -41,6 +42,7 @@ public interface StrangerAccessRecordService extends BaseService<StrangerAccessR
* @date 2020-03-19
*/
PageData<StrangerAccessRecordDTO> page(Map<String, Object> params);
/**
* 默认查询
*
@ -92,9 +94,9 @@ public interface StrangerAccessRecordService extends BaseService<StrangerAccessR
void delete(String[] ids);
/**
* @return Result<List < CustomerGridForStrangerResultDTO>>
* @Description 陌生人根据地区编码查询附近网格数据接口定义
* @Param CustomerGridListFormDTO
* @return Result<List<CustomerGridForStrangerResultDTO>>
* @Author wangc
* @Date 2020.03.19 14:28
**/
@ -102,9 +104,10 @@ public interface StrangerAccessRecordService extends BaseService<StrangerAccessR
/**
* 居民端-网格链接获取客户首页配置
*
* @param
* @return void
* @author sun
*/
Result<HomeDesignByCustomerResultDTO> getgridhome(TokenDto tokenDTO, StrangerFormDTO formDTO) throws Exception;
Result<HomeDesignByCustomerResultDTO> getGridHome(TokenDto tokenDTO, StrangerFormDTO formDTO);
}

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

@ -1,13 +1,17 @@
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.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.StrangerResiGuideConstant;
import com.epmet.dao.StrangerAccessRecordDao;
import com.epmet.dto.StrangerAccessRecordDTO;
import com.epmet.dto.form.*;
@ -18,17 +22,16 @@ import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.OperCustomizeFeignClient;
import com.epmet.service.StrangerAccessRecordService;
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;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.tools.page.PageData;
import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* @Description 陌生人记录访问表
* @ClassName ResiGuideServiceImpl
@ -37,6 +40,8 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Service
public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements StrangerAccessRecordService {
private static final Logger log = LoggerFactory.getLogger(StrangerAccessRecordServiceImpl.class);
@Autowired
private StrangerAccessRecordDao strangerAccessRecordDao;
@Autowired
@ -45,8 +50,10 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private OperCustomizeFeignClient operCustomizeFeignClient;
/**
* 查询陌生人访问记录
*
* @param params
* @return PageData<StrangerAccessRecordDTO>
* @author yangshaoping
@ -55,13 +62,15 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
@Override
public PageData<StrangerAccessRecordDTO> getStrangerAccessRecordPage(Map<String, Object> params) {
//当前陌生人访客记录查询只能查询最近三天,无法查询三天以外的数据,需要完善功能
IPage<StrangerAccessRecordEntity> page = baseDao.selectPage(
getPage(params, "VISIT_TIME",false),
getPage(params, "VISIT_TIME", false),
getWrapper(params)
);
return getPageData(page,StrangerAccessRecordDTO.class);
return getPageData(page, StrangerAccessRecordDTO.class);
}
@Override
public PageData<StrangerAccessRecordDTO> page(Map<String, Object> params) {
IPage<StrangerAccessRecordEntity> page = baseDao.selectPage(
@ -86,15 +95,15 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
* @author
* @date
*/
private QueryWrapper<StrangerAccessRecordEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<StrangerAccessRecordEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<StrangerAccessRecordEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
Calendar before3daysDate = Calendar.getInstance();
before3daysDate.setTime(new Date());
before3daysDate.add(Calendar.DATE,-3);
wrapper.between("VISIT_TIME", before3daysDate.getTime(),new Date());
before3daysDate.add(Calendar.DATE, -3);
wrapper.between("VISIT_TIME", before3daysDate.getTime(), new Date());
return wrapper;
}
@ -139,32 +148,30 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO();
listCustomerGridFormDTO.setAreaCode(0 == customerGridListFormDTO.getIsAuthorized() ?
listCustomerGridFormDTO.setAreaCode(ModuleConstant.NOT_POSITION_AUTHORIZED == customerGridListFormDTO.getIsAuthorized() ?
customerGridListFormDTO.getSelectedAreaCode() : customerGridListFormDTO.getAreaCode());
listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? 1 : customerGridListFormDTO.getPageNo());
listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? ModuleConstant.MIN_CURRENT_PAGE_NO : customerGridListFormDTO.getPageNo());
listCustomerGridFormDTO.setPageSize(customerGridListFormDTO.getPageSize());
Result<List<CustomerGridForStrangerResultDTO>> queryResult =
govOrgFeignClient
.getPageForStrangerGuideInterface(listCustomerGridFormDTO);
.queryGridListByAreaCode(listCustomerGridFormDTO);
//Feign调用成功
if(queryResult.success()) {
if (queryResult.success()) {
List<CustomerGridForStrangerResultDTO> queryList = queryResult.getData();
if (null != queryResult && queryList.size() > 0) {
StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity();
//未授权,手动选择
if (0 == customerGridListFormDTO.getIsAuthorized()) {
if (ModuleConstant.NOT_POSITION_AUTHORIZED == customerGridListFormDTO.getIsAuthorized()) {
strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode());
strangerTrance.setLocationAreaCode("");
} else if (1 == customerGridListFormDTO.getIsAuthorized()) {
} else if (ModuleConstant.POSITION_AUTHORIZED == customerGridListFormDTO.getIsAuthorized()) {
//已授权,自动选择
strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode());
strangerTrance.setSelectedAreaCode("");
}
strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized());
strangerTrance.setGridNumber(queryList.size());
@ -179,9 +186,9 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
//没有查询出结果
return new Result<List<CustomerGridForStrangerResultDTO>>().ok(new ArrayList<>());
}
}else{
} else {
//Feign调用失败
return new Result<List<CustomerGridForStrangerResultDTO>>().error(queryResult.getCode(),queryResult.getMsg());
return new Result<List<CustomerGridForStrangerResultDTO>>().error(queryResult.getCode(), queryResult.getMsg());
}
@ -189,42 +196,44 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
/**
* 居民端-网格链接获取客户首页配置
*
* @return void
* @author sun
*/
@Override
public Result<HomeDesignByCustomerResultDTO> getgridhome(TokenDto tokenDTO, StrangerFormDTO formDTO) throws Exception {
public Result<HomeDesignByCustomerResultDTO> getGridHome(TokenDto tokenDTO, StrangerFormDTO strangerFormDTO) {
//1.先判断参数
//居民端 所以参数必须是居民端的参数 否则就是参数错误s
if (!AppClientConstant.APP_RESI.equals(tokenDTO.getApp())) {
return new Result<HomeDesignByCustomerResultDTO>().error(StrangerResiGuideConstant.PARAMETER_EXCEPTION);
}
//token里边有所属端 userId这些参数 前台传递customerID和gridId
//1:调用epmet-user服务查询数据 新建网格记录数据
VisitedFormDTO vi = new VisitedFormDTO();
vi.setGridId(formDTO.getGridId());
vi.setCustomerId(formDTO.getCustomerId());
vi.setUserId(tokenDTO.getUserId());//token中获取userId
epmetUserFeignClient.saveLatestAndVisited(vi);
//2:调用ope-customize服务 获取首页发布数据
Result<HomeDesignByCustomerResultDTO> res = getCustomerHomeData(formDTO.getCustomerId(),tokenDTO.getApp());
return res;
//2:调用epmet-user服务查询数据 新建网格记录数据
VisitedFormDTO visitedFormDTO = new VisitedFormDTO();
visitedFormDTO.setGridId(strangerFormDTO.getGridId());
visitedFormDTO.setCustomerId(strangerFormDTO.getCustomerId());
visitedFormDTO.setUserId(tokenDTO.getUserId());//token中获取userId
Result re = epmetUserFeignClient.saveVisitedRecord(visitedFormDTO);
if (!re.success()) {
log.warn(StrangerResiGuideConstant.EPMET_USER_EXCEPTION);
}
//3:调用ope-customize服务 获取首页发布数据
Result<HomeDesignByCustomerResultDTO> result = getCustomerHomeData(strangerFormDTO.getCustomerId());
return result;
}
/**
* 调用oper-customize服务 获取首页发布数据
* @param customerId 客户Id
* @param clientType 所属端
*
* @param customerId 客户Id
* @return
* @author sun
*/
public Result<HomeDesignByCustomerResultDTO> getCustomerHomeData(String customerId,String clientType) throws Exception {
CustomerHomeFormDTO dto = new CustomerHomeFormDTO();
dto.setCustomerId(customerId);
//居民端 所以参数必须是居民端的参数 否则就是参数错误s
if (AppClientConstant.APP_RESI.equals(clientType)){//居民端
dto.setClientType(NumConstant.ZERO_STR);
}else {
throw new Exception("参数异常,app端不是指定的居民端,请检查token信息!");
}
return operCustomizeFeignClient.getHomeReleaseByCustomer(dto);
public Result<HomeDesignByCustomerResultDTO> getCustomerHomeData(String customerId) {
CustomerHomeFormDTO customerHomeFormDTO = new CustomerHomeFormDTO();
customerHomeFormDTO.setCustomerId(customerId);
customerHomeFormDTO.setClientType(NumConstant.ZERO_STR);
return operCustomizeFeignClient.getHomeReleaseByCustomer(customerHomeFormDTO);
}

8
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -18,4 +18,12 @@ import com.epmet.commons.tools.constant.Constant;
*/
public interface ModuleConstant extends Constant {
//位置未授权
int NOT_POSITION_AUTHORIZED = 0;
//位置授权
int POSITION_AUTHORIZED = 1;
//当前页最小值
int MIN_CURRENT_PAGE_NO = 1;
}

21
epmet-module/resi-mine/pom.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-module</artifactId>
<version>2.0.0</version>
</parent>
<groupId>com.epmet</groupId>
<artifactId>resi-mine</artifactId>
<packaging>pom</packaging>
<modules>
<module>resi-mine-client</module>
<module>resi-mine-server</module>
</modules>
</project>

35
epmet-module/resi-mine/resi-mine-client/pom.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.epmet</groupId>
<artifactId>resi-mine</artifactId>
<version>2.0.0</version>
</parent>
<artifactId>resi-mine-client</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>

0
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/form/.gitkeep

0
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/.gitkeep

154
epmet-module/resi-mine/resi-mine-server/pom.xml

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.epmet</groupId>
<artifactId>resi-mine</artifactId>
<version>2.0.0</version>
</parent>
<artifactId>resi-mine-server</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>resi-mine-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-mybatis</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring.boot.admin.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- 替换Feign原生httpclient -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<server.port>8094</server.port>
<spring.profiles.active>dev</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_resi_guide?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
</properties>
</profile>
<profile>
<id>test</id>
<!--<activation>
<activeByDefault>true</activeByDefault>
</activation>-->
<properties>
<server.port>8094</server.port>
<spring.profiles.active>test</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_resi_guide?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
</properties>
</profile>
</profiles>
</project>

31
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/ResiMineApplication.java

@ -0,0 +1,31 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* 模块
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class ResiMineApplication {
public static void main(String[] args) {
SpringApplication.run(ResiMineApplication.class, args);
}
}

26
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/config/ModuleConfigImpl.java

@ -0,0 +1,26 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.config;
import com.epmet.commons.tools.config.ModuleConfig;
import org.springframework.stereotype.Service;
/**
* 模块配置信息
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Service
public class ModuleConfigImpl implements ModuleConfig {
@Override
public String getName() {
return "resimine";
}
}

68
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/config/SwaggerConfig.java

@ -0,0 +1,68 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.config;
import com.epmet.commons.tools.constant.Constant;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
/**
* Swagger配置
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig implements WebMvcConfigurer {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类,才生成接口文档
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
.paths(PathSelectors.any())
.build()
.directModelSubstitute(java.util.Date.class, String.class)
.securitySchemes(security());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("人人开源")
.description("模块接口文档")
.termsOfServiceUrl("https://www.renren.io")
.version("1.1.0")
.build();
}
private List<ApiKey> security() {
return newArrayList(
new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header")
);
}
}

35
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/controller/ResiMineGridController.java

@ -0,0 +1,35 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.service.ResiMineGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description 居民端用户网格信息相关接口入口
* @Author yinzuomei
* @Date 2020/3/24 11:02
*/
@RestController
@RequestMapping("minegrid")
public class ResiMineGridController {
@Autowired
private ResiMineGridService resiMineGridService;
/**
* @return com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO
* @param tokenDto
* @Author yinzuomei
* @Description 获取用户最近访问网格
* @Date 2020/3/24 11:10
**/
@GetMapping("getlatestgridinfo")
public Result<LatestGridInfoResultDTO> getLatestGridInfo(@LoginUser TokenDto tokenDto){
return resiMineGridService.getLatestGridInfo(tokenDto);
}
}

0
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/dao/.gitkeep

0
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/entity/.gitkeep

0
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/excel/.gitkeep

25
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/exception/ModuleErrorCode.java

@ -0,0 +1,25 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.exception;
import com.epmet.commons.tools.exception.ErrorCode;
/**
* 模块错误编码由9位数字组成前6位为模块编码后3位为业务编码
* <p>
* 100001001100001代表模块001代表业务代码
* </p>
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public interface ModuleErrorCode extends ErrorCode {
}

27
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -0,0 +1,27 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* @Description 居民端陌生人导览 调用epmet-user服务
* @Author sun
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class)
public interface EpmetUserFeignClient {
/**
* @param userId
* @return com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:05
**/
@GetMapping(value = "epmetuser/gridlatest/getLatestGridInfoByUserId/{userId}")
Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(@PathVariable("userId") String userId);
}

29
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -0,0 +1,29 @@
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.result.LatestGridInfoResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
/**
* @Description 居民端-陌生人导览 调用epmet-user服务
* @Author sun
* @Date 2020/3/16
*/
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
/**
* @param userId
* @return com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:05
**/
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestGridInfoByUserId", userId);
}
}

21
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/service/ResiMineGridService.java

@ -0,0 +1,21 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.LatestGridInfoResultDTO;
/**
* @Description 居民端用户网格信息service
* @Author yinzuomei
* @Date 2020/3/24 11:04
*/
public interface ResiMineGridService {
/**
* 获取用户最近访问网格
*
* @Author yinzuomei
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO>
*/
Result<LatestGridInfoResultDTO> getLatestGridInfo(TokenDto tokenDto);
}

42
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/service/impl/ResiMineGridServiceImpl.java

@ -0,0 +1,42 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.service.ResiMineGridService;
import com.epmet.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Description 居民端用户网格信息service
* @Author yinzuomei
* @Date 2020/3/24 11:04
*/
@Service
public class ResiMineGridServiceImpl implements ResiMineGridService {
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
/**
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.mine.dto.result.LatestGridInfoResultDTO>
* @Author yinzuomei
* @Description 获取用户最近访问网格
* @Date 2020/3/24 11:11
**/
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfo(TokenDto tokenDto) {
if (null == tokenDto || StringUtils.isBlank(tokenDto.getUserId())) {
return new Result<LatestGridInfoResultDTO>().error(ModuleConstant.USER_NOT_NULL);
}
if(!AppClientConstant.APP_RESI.equals(tokenDto.getApp())){
return new Result<LatestGridInfoResultDTO>().error(ModuleConstant.FOR_RESI_CALL);
}
return epmetUserFeignClient.getLatestGridInfoByUserId(tokenDto.getUserId());
}
}

30
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -0,0 +1,30 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.utils;
import com.epmet.commons.tools.constant.Constant;
/**
* 模块常量
*
* @author Mark sunlightcs@gmail.com
* @since 1.1.0
*/
public interface ModuleConstant extends Constant {
/**
* tokenDto不能为null userId不能为空
*/
String USER_NOT_NULL="用户信息不能为空";
/**
* 接口只限居民端调用
*/
String FOR_RESI_CALL="当前接口只限居民端调用";
}

106
epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml

@ -0,0 +1,106 @@
server:
port: @server.port@
servlet:
context-path: /resi/mine
spring:
main:
allow-bean-definition-overriding: true
application:
name: resi-mine-server
#环境 dev|test|prod
profiles:
active: dev
messages:
encoding: UTF-8
basename: i18n/messages,i18n/messages_common
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
redis:
database: @spring.redis.index@
host: @spring.redis.host@
port: @spring.redis.port@
password: @spring.redis.password@
timeout: 30s
datasource:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: @spring.datasource.druid.url@
username: @spring.datasource.druid.username@
password: @spring.datasource.druid.password@
cloud:
nacos:
discovery:
server-addr: @nacos.server-addr@
#nacos的命名空间ID,默认是public
namespace: @nacos.discovery.namespace@
#不把自己注册到注册中心的地址
register-enabled: @nacos.register-enabled@
ip: @nacos.ip@
config:
enabled: @nacos.config-enabled@
server-addr: @nacos.server-addr@
namespace: @nacos.config.namespace@
group: @nacos.config.group@
file-extension: yaml
#指定共享配置,且支持动态刷新
# ext-config:
# - data-id: datasource.yaml
# group: ${spring.cloud.nacos.config.group}
# refresh: true
# - data-id: common.yaml
# group: ${spring.cloud.nacos.config.group}
# refresh: true
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.epmet.resi.mine.entity
global-config:
#数据库相关配置
db-config:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: ID_WORKER
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy: NOT_NULL
#驼峰下划线转换
column-underline: true
banner: false
#原生配置
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
feign:
hystrix:
enabled: true
client:
config:
default:
loggerLevel: BASIC
httpclient:
enabled: true
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000 #缺省为1000
ribbon:
ReadTimeout: 300000
ConnectTimeout: 300000

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages.properties

@ -0,0 +1 @@
#Default

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages_en_US.properties

@ -0,0 +1 @@
#English

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages_zh_CN.properties

@ -0,0 +1 @@
#\u7B80\u4F53\u4E2D\u6587

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/messages_zh_TW.properties

@ -0,0 +1 @@
#\u7E41\u4F53\u4E2D\u6587

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation.properties

@ -0,0 +1 @@
#Default

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation_en_US.properties

@ -0,0 +1 @@
#English

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation_zh_CN.properties

@ -0,0 +1 @@
#\u7B80\u4F53\u4E2D\u6587

1
epmet-module/resi-mine/resi-mine-server/src/main/resources/i18n/validation_zh_TW.properties

@ -0,0 +1 @@
#\u7E41\u4F53\u4E2D\u6587

159
epmet-module/resi-mine/resi-mine-server/src/main/resources/logback-spring.xml

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<property name="log.path" value="logs/resi-mine"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--1. 输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--2. 输出到文档-->
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/debug.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.2 level为 INFO 日志,时间滚动输出 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/info.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.3 level为 WARN 日志,时间滚动输出 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/warn.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/error.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.epmet.dao" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
</configuration>

25
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestGridInfoResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 获取用户最近访问网格返参DTO
* @Author yinzuomei
* @Date 2020/3/24 11:09
*/
@Data
public class LatestGridInfoResultDTO implements Serializable {
private static final long serialVersionUID = 8548569698676898706L;
/**
* 用户最后一次访问的网格对应的客户id
*/
private String customerId;
/**
* 用户最后一次访问的网格
*/
private String gridId;
}

2
epmet-user/epmet-user-server/pom.xml

@ -115,7 +115,7 @@
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.host>10.10.10.79</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->

37
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/GridVisitedConstant.java

@ -0,0 +1,37 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.constant;
/**
* 常量
* @author sun
* @since 1.0.0
*/
public interface GridVisitedConstant {
/**
* 查询异常
*/
String QUERY_EXCEPTION = "查询客户网格表数据失败!";
/**
* 网格访问记录表新增数据失败
*/
String SAVE_VISITED = "网格访问记录表新增数据失败!";
/**
* 最近访问网格表新增数据失败
*/
String SAVE_LATEST = "最近访问网格表新增数据失败!";
/**
* tokenDto中的userId不能为空
*/
String USER_ID_NOTNULL="用户id不能为空";
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.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.GridLatestDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.excel.GridLatestExcel;
import com.epmet.service.GridLatestService;
import org.springframework.beans.factory.annotation.Autowired;
@ -45,7 +46,7 @@ import java.util.Map;
@RestController
@RequestMapping("gridlatest")
public class GridLatestController {
@Autowired
private GridLatestService gridLatestService;
@ -91,4 +92,15 @@ public class GridLatestController {
ExcelUtils.exportExcelToTarget(response, null, list, GridLatestExcel.class);
}
}
/**
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestGridInfoResultDTO>
* @param userId
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:09
**/
@GetMapping("getLatestGridInfoByUserId/{userId}")
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(@PathVariable("userId") String userId){
return gridLatestService.getLatestGridInfoByUserId(userId);
}
}

21
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java

@ -46,24 +46,24 @@ import java.util.Map;
@RestController
@RequestMapping("gridvisited")
public class GridVisitedController {
@Autowired
private GridVisitedService gridVisitedService;
@GetMapping("page")
public Result<PageData<GridVisitedDTO>> page(@RequestParam Map<String, Object> params){
public Result<PageData<GridVisitedDTO>> page(@RequestParam Map<String, Object> params) {
PageData<GridVisitedDTO> page = gridVisitedService.page(params);
return new Result<PageData<GridVisitedDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<GridVisitedDTO> get(@PathVariable("id") String id){
public Result<GridVisitedDTO> get(@PathVariable("id") String id) {
GridVisitedDTO data = gridVisitedService.get(id);
return new Result<GridVisitedDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody GridVisitedDTO dto){
public Result save(@RequestBody GridVisitedDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
gridVisitedService.save(dto);
@ -71,7 +71,7 @@ public class GridVisitedController {
}
@PutMapping
public Result update(@RequestBody GridVisitedDTO dto){
public Result update(@RequestBody GridVisitedDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
gridVisitedService.update(dto);
@ -79,7 +79,7 @@ public class GridVisitedController {
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
gridVisitedService.delete(ids);
@ -96,11 +96,12 @@ public class GridVisitedController {
* 网格访问记录表最近访问网格表新增数据
* 网格访问记录表新增数据(一天一条)
* 最近访问表更新访问时间字段
* @param formDTO
*
* @param visitedFormDTO
*/
@PostMapping("savelatestandvisited")
public void saveLatestAndVisited(@RequestBody VisitedFormDTO formDTO) throws Exception {
gridVisitedService.saveLatestAndVisited(formDTO);
@PostMapping("savevisitedrecord")
public Result saveVisitedRecord(@RequestBody VisitedFormDTO visitedFormDTO) {
return gridVisitedService.saveVisitedRecord(visitedFormDTO);
}
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GridLatestDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.entity.GridLatestEntity;
import org.apache.ibatis.annotations.Mapper;
@ -31,5 +32,18 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GridLatestDao extends BaseDao<GridLatestEntity> {
GridLatestDTO selectGridLatestByGridAndUserId(GridLatestDTO formDTO);
int updateByLatestId(GridLatestDTO dto);
GridLatestEntity getGridLatestByIds(GridLatestDTO formDTO);
}
/**
* @return com.epmet.dto.result.LatestGridInfoResultDTO
* @param userId
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:17
**/
LatestGridInfoResultDTO selectLatestGridInfoByUserId(String userId);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java

@ -33,5 +33,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GridVisitedDao extends BaseDao<GridVisitedEntity> {
GridVisitedDTO getGridVisitedByIds(GridVisitedDTO formDTO);
GridVisitedDTO selectGridVisitedByGridIdAndUserId(GridVisitedDTO formDTO);
int updateByVisitedId(GridVisitedDTO dto);
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -16,12 +16,12 @@ import org.springframework.web.bind.annotation.PostMapping;
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class)
public interface GovOrgFeignClient {
/**
* @param
* @Description 根据客户Id查询客户用户表数据
* @Date 2020/3/17
**/
@PostMapping("/gov/org/customergrid/getcustomergridbygridid")
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO);
/**
* @param
* @Description 根据客户Id查询客户用户表数据
* @Date 2020/3/17
**/
@PostMapping("/gov/org/customergrid/getcustomergridbygridid")
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperRoleUserFeignClient.java

@ -13,7 +13,7 @@ import java.util.List;
* @dscription
* @date 2020/3/20 17:19
*/
@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallback = OperRoleUserFeignClientFallBack.class)
@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallback = OperRoleUserFeignClientFallBack.class )
public interface OperRoleUserFeignClient {
/**

8
epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java

@ -16,8 +16,8 @@ import org.springframework.stereotype.Component;
@Component
public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
@Override
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerGridByGridId",formDTO);
}
@Override
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerGridByGridId", formDTO);
}
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java

@ -19,9 +19,11 @@ 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.GridLatestDTO;
import com.epmet.dto.form.VisitedFormDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.entity.GridLatestEntity;
import java.util.List;
@ -99,5 +101,15 @@ public interface GridLatestService extends BaseService<GridLatestEntity> {
* 最近访问网格表新增数据
* @param formDTO
*/
void saveGridLatest(VisitedFormDTO formDTO, CustomerGridDTO cu);
}
boolean saveGridLatest(VisitedFormDTO formDTO, CustomerGridDTO cu);
/**
* @param userId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestGridInfoResultDTO>
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:10
**/
Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId);
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java

@ -19,6 +19,7 @@ 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.GridLatestDTO;
import com.epmet.dto.GridVisitedDTO;
import com.epmet.dto.form.VisitedFormDTO;
@ -95,23 +96,8 @@ public interface GridVisitedService extends BaseService<GridVisitedEntity> {
*/
void delete(String[] ids);
/**
* 网格访问记录表新增数据
* @param formDTO
*/
//void saveGridVisited(GridVisitedDTO formDTO);
/**
* @param formDTO
*/
void saveLatestAndVisited(VisitedFormDTO formDTO) throws Exception;
Result saveVisitedRecord(VisitedFormDTO formDTO);
}

62
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java

@ -23,10 +23,13 @@ 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.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.GridVisitedConstant;
import com.epmet.dao.GridLatestDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.GridLatestDTO;
import com.epmet.dto.form.VisitedFormDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.entity.GridLatestEntity;
import com.epmet.redis.GridLatestRedis;
import com.epmet.service.GridLatestService;
@ -51,6 +54,8 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
@Autowired
private GridLatestRedis gridLatestRedis;
@Autowired
private GridLatestDao gridLatestDao;
@Override
public PageData<GridLatestDTO> page(Map<String, Object> params) {
@ -68,8 +73,8 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
return ConvertUtils.sourceToTarget(entityList, GridLatestDTO.class);
}
private QueryWrapper<GridLatestEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<GridLatestEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<GridLatestEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -106,31 +111,42 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
@Override
@Transactional(rollbackFor = Exception.class)
public void saveGridLatest(VisitedFormDTO formDTO, CustomerGridDTO cu) {
public boolean saveGridLatest(VisitedFormDTO visitedFormDTO, CustomerGridDTO customerGridDTO) {
Date date = new Date();
GridLatestDTO la = new GridLatestDTO();
la.setCustomerId(cu.getCustomerId());
la.setGridId(cu.getId());
//la.setCustomerUserId(formDTO.getUserId());//token传递的值
la.setCustomerUserId("1111111111");//token传递的值
la.setAreaCode(cu.getAreaCode());
la.setPid(cu.getPid());
la.setLatestTime(date);
la.setUpdatedTime(date);
GridLatestDTO gridLatestDTO = new GridLatestDTO();
gridLatestDTO.setCustomerId(customerGridDTO.getCustomerId());
gridLatestDTO.setGridId(customerGridDTO.getId());
gridLatestDTO.setCustomerUserId(visitedFormDTO.getUserId());
gridLatestDTO.setAreaCode(customerGridDTO.getAreaCode());
gridLatestDTO.setPid(customerGridDTO.getPid());
gridLatestDTO.setLatestTime(date);
gridLatestDTO.setUpdatedTime(date);
//查询是否存在历史数据(一个用户对一个网格的访问只记录一条数据)
GridLatestEntity dto = baseDao.getGridLatestByIds(la);
GridLatestDTO dto = baseDao.selectGridLatestByGridAndUserId(gridLatestDTO);
GridLatestEntity entity = null;
if(dto==null||dto.getId()==null){
entity = ConvertUtils.sourceToTarget(la, GridLatestEntity.class);
insert(entity);
}else{
entity = ConvertUtils.sourceToTarget(dto, GridLatestEntity.class);
entity.setLatestTime(date);//最近访问时间
entity.setUpdatedTime(date);
updateById(entity);
if (null == dto || null == dto.getId()) {
entity = ConvertUtils.sourceToTarget(gridLatestDTO, GridLatestEntity.class);
return insert(entity);
} else {
dto.setUpdatedBy(visitedFormDTO.getUserId());
dto.setUpdatedTime(date);
return BaseServiceImpl.retBool(gridLatestDao.updateByLatestId(dto));
}
}
}
/**
* @param userId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.LatestGridInfoResultDTO>
* @Author yinzuomei
* @Description 根据居民id查询最后一次访问的网格信息
* @Date 2020/3/24 13:10
**/
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId) {
if(StringUtils.isBlank(userId)){
return new Result<LatestGridInfoResultDTO>().error(GridVisitedConstant.USER_ID_NOTNULL);
}
return new Result<LatestGridInfoResultDTO>().ok(baseDao.selectLatestGridInfoByUserId(userId));
}
}

88
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java

@ -24,6 +24,7 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.GridVisitedConstant;
import com.epmet.dao.GridVisitedDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.GridVisitedDTO;
@ -34,6 +35,8 @@ import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.GridLatestService;
import com.epmet.service.GridVisitedService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -52,10 +55,13 @@ import java.util.Map;
@Service
public class GridVisitedServiceImpl extends BaseServiceImpl<GridVisitedDao, GridVisitedEntity> implements GridVisitedService {
private static final Logger log = LoggerFactory.getLogger(GridVisitedServiceImpl.class);
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private GridLatestService gridLatestService;
@Autowired
private GridVisitedDao gridVisitedDao;
@Override
public PageData<GridVisitedDTO> page(Map<String, Object> params) {
@ -73,8 +79,8 @@ public class GridVisitedServiceImpl extends BaseServiceImpl<GridVisitedDao, Grid
return ConvertUtils.sourceToTarget(entityList, GridVisitedDTO.class);
}
private QueryWrapper<GridVisitedEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<GridVisitedEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<GridVisitedEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -111,63 +117,73 @@ public class GridVisitedServiceImpl extends BaseServiceImpl<GridVisitedDao, Grid
/**
* 网格记录表新增数据
* @author sun
* @param formDTO
*
* @param visitedFormDTO
* @throws Exception
* @author sun
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveLatestAndVisited(VisitedFormDTO formDTO) throws Exception {
public Result saveVisitedRecord(VisitedFormDTO visitedFormDTO) {
Result result = new Result();
//1:调用gov-org服务 查询客户网格表数据
CustomerGridFormDTO dto = new CustomerGridFormDTO();
dto.setGridId(formDTO.getGridId());
Result<CustomerGridDTO> result = govOrgFeignClient.getCustomerGridByGridId(dto);
if(!result.success()){
throw new Exception("查询客户网格表数据失败!");
dto.setGridId(visitedFormDTO.getGridId());
Result<CustomerGridDTO> gridDTO = govOrgFeignClient.getCustomerGridByGridId(dto);
if (!gridDTO.success()) {
log.warn(GridVisitedConstant.QUERY_EXCEPTION);
result.error(GridVisitedConstant.QUERY_EXCEPTION);
}
CustomerGridDTO cu = result.getData();
CustomerGridDTO customerGridDTO = gridDTO.getData();
//2:网格访问记录表新增数据
saveGridVisited(formDTO,cu);
if (!saveGridVisited(visitedFormDTO, customerGridDTO)) {
log.warn(GridVisitedConstant.SAVE_VISITED);
result.error(GridVisitedConstant.SAVE_VISITED);
}
//3:最近访问网格表新增数据
gridLatestService.saveGridLatest(formDTO,cu);
if (!gridLatestService.saveGridLatest(visitedFormDTO, customerGridDTO)) {
log.warn(GridVisitedConstant.SAVE_LATEST);
result.error(GridVisitedConstant.SAVE_LATEST);
}
return result;
}
/**
* 网格记录表和最近访问网格表新增数据
* @param formDTO
* @param cu
*
* @param visitedFormDTO
* @param customerGridDTO
*/
public void saveGridVisited(VisitedFormDTO formDTO,CustomerGridDTO cu) {
private boolean saveGridVisited(VisitedFormDTO visitedFormDTO, CustomerGridDTO customerGridDTO) {
Date date = new Date();
GridVisitedDTO vi = new GridVisitedDTO();
vi.setIsRegister(getRegister("0"));//后续再其他服务中获取这个状态值
vi.setCustomerId(cu.getCustomerId());
vi.setGridId(cu.getId());
vi.setCustomerUserId(formDTO.getUserId());
vi.setVisitTime(date);
vi.setUpdatedTime(date);
GridVisitedDTO gridVisitedDTO = new GridVisitedDTO();
//TODO:预留方法 根据userId查询用户是否认证(注册)
gridVisitedDTO.setIsRegister(getRegisterByUserId(visitedFormDTO.getUserId()));
gridVisitedDTO.setCustomerId(customerGridDTO.getCustomerId());
gridVisitedDTO.setGridId(customerGridDTO.getId());
gridVisitedDTO.setCustomerUserId(visitedFormDTO.getUserId());
gridVisitedDTO.setVisitTime(date);
gridVisitedDTO.setUpdatedTime(date);
//查询是否存在历史数据( 一个用户一天对一个网格只存在一条访问记录)
GridVisitedDTO dto = baseDao.getGridVisitedByIds(vi);
GridVisitedDTO dto = baseDao.selectGridVisitedByGridIdAndUserId(gridVisitedDTO);
GridVisitedEntity entity = null;
if(dto==null||dto.getId()==null){
entity = ConvertUtils.sourceToTarget(vi, GridVisitedEntity.class);
insert(entity);
}else{
entity = ConvertUtils.sourceToTarget(dto, GridVisitedEntity.class);
entity.setUpdatedTime(date);
updateById(entity);
if (dto == null || dto.getId() == null) {
entity = ConvertUtils.sourceToTarget(gridVisitedDTO, GridVisitedEntity.class);
return insert(entity);
} else {
dto.setUpdatedBy(visitedFormDTO.getUserId());
dto.setUpdatedTime(date);
return BaseServiceImpl.retBool(gridVisitedDao.updateByVisitedId(dto));
}
}
/**
* (预留方法)查询是否注册状态值
* @param str
* (预留方法)查询是否注册的状态值
*
* @param userId
* @return
*/
public Integer getRegister(String str){
public Integer getRegisterByUserId(String userId) {
return 0;
}

28
epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml

@ -19,8 +19,8 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getGridLatestByIds" parameterType="com.epmet.dto.GridLatestDTO"
resultType="com.epmet.entity.GridLatestEntity">
<select id="selectGridLatestByGridAndUserId" parameterType="com.epmet.dto.GridLatestDTO"
resultType="com.epmet.dto.GridLatestDTO">
SELECT
la.id,
la.customer_id,
@ -49,4 +49,26 @@
</if>
</select>
</mapper>
<update id="updateByLatestId">
UPDATE grid_latest
SET latest_time = #{latestTime},
updated_by = #{updatedBy},
updated_time = #{updatedTime}
WHERE id = #{id}
</update>
<!-- 根据居民id查询最后一次访问的网格信息 -->
<select id="selectLatestGridInfoByUserId" resultType="com.epmet.dto.result.LatestGridInfoResultDTO" parameterType="java.lang.String">
SELECT
gl.GRID_ID,
gl.CUSTOMER_ID
FROM
grid_latest gl
WHERE
gl.DEL_FLAG = '0'
AND gl.CUSTOMER_USER_ID = #{userId}
ORDER BY
gl.LATEST_TIME DESC
LIMIT 1
</select>
</mapper>

9
epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml

@ -18,7 +18,7 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="getGridVisitedByIds" parameterType="com.epmet.dto.GridVisitedDTO"
<select id="selectGridVisitedByGridIdAndUserId" parameterType="com.epmet.dto.GridVisitedDTO"
resultType="com.epmet.dto.GridVisitedDTO">
SELECT
vi.id,
@ -50,4 +50,11 @@
</if>
</select>
<update id="updateByVisitedId">
UPDATE grid_visited
SET updated_by = #{updatedBy},
updated_time = #{updatedTime}
WHERE id = #{id}
</update>
</mapper>
Loading…
Cancel
Save