Browse Source

Merge remote-tracking branch 'origin/dev_heart' into dev_heart

# Conflicts:
#	epmet-module/epmet-point/epmet-point-server/pom.xml
#	epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
#	epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
#	epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
dev_shibei_match
wangchao 5 years ago
parent
commit
e901f09aeb
  1. 2
      epmet-auth/deploy/docker-compose-dev.yml
  2. 2
      epmet-auth/deploy/docker-compose-prod.yml
  3. 2
      epmet-auth/deploy/docker-compose-test.yml
  4. 10
      epmet-auth/pom.xml
  5. 14
      epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java
  6. 14
      epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java
  7. 6
      epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java
  8. 4
      epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java
  9. 2
      epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java
  10. 2
      epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java
  11. 47
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java
  12. 117
      epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java
  13. 3
      epmet-auth/src/main/java/com/epmet/service/LoginService.java
  14. 9
      epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java
  15. 9
      epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java
  16. 14
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  17. 37
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  18. 44
      epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java
  19. 102
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  20. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java
  21. 25
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  22. 41
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java
  23. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java
  24. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java
  25. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java
  26. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java
  27. 42
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java
  28. 47
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java
  29. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java
  30. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  31. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  32. 22
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  33. 37
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java
  34. 97
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  35. 59
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java
  36. 2
      epmet-gateway/deploy/docker-compose-dev.yml
  37. 2
      epmet-gateway/deploy/docker-compose-prod.yml
  38. 9
      epmet-gateway/pom.xml
  39. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  40. 2
      epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml
  41. 2
      epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml
  42. 2
      epmet-module/data-statistical/data-statistical-server/pom.xml
  43. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java
  44. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java
  45. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  46. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  47. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java
  48. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java
  49. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java
  50. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java
  51. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java
  52. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java
  53. 129
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java
  54. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  55. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  56. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java
  57. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  58. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  59. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java
  60. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  61. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java
  62. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java
  63. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java
  64. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java
  65. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java
  66. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java
  67. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java
  68. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java
  69. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml
  70. 20
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml
  71. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  72. 25
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
  73. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml
  74. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml
  75. 17
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml
  76. 17
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml
  77. 4
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java
  78. 56
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java
  79. 10
      epmet-module/epmet-common-service/common-service-server/pom.xml
  80. 30
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java
  81. 5
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java
  82. 6
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java
  83. 6
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java
  84. 36
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java
  85. 10
      epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml
  86. 37
      epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql
  87. 2
      epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml
  88. 6
      epmet-module/epmet-heart/epmet-heart-client/pom.xml
  89. 11
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java
  90. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java
  91. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java
  92. 15
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java
  93. 14
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java
  94. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java
  95. 81
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java
  96. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java
  97. 46
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java
  98. 38
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java
  99. 104
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java
  100. 61
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java

2
epmet-auth/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services: services:
epmet-auth-server: epmet-auth-server:
container_name: epmet-auth-server-dev container_name: epmet-auth-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.43 image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.56
ports: ports:
- "8081:8081" - "8081:8081"
network_mode: host # 使用现有网络 network_mode: host # 使用现有网络

2
epmet-auth/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services: services:
epmet-auth-server: epmet-auth-server:
container_name: epmet-auth-server-prod container_name: epmet-auth-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.36 image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.56
ports: ports:
- "8081:8081" - "8081:8081"
network_mode: host # 使用现有网络 network_mode: host # 使用现有网络

2
epmet-auth/deploy/docker-compose-test.yml

@ -2,7 +2,7 @@ version: "3.7"
services: services:
epmet-auth-server: epmet-auth-server:
container_name: epmet-auth-server-test container_name: epmet-auth-server-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.36 image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.56
ports: ports:
- "8081:8081" - "8081:8081"
network_mode: host # 使用现有网络 network_mode: host # 使用现有网络

10
epmet-auth/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> 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> <modelVersion>4.0.0</modelVersion>
<version>0.3.43</version> <version>0.3.56</version>
<parent> <parent>
<groupId>com.epmet</groupId> <groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId> <artifactId>epmet-cloud</artifactId>
@ -122,6 +122,12 @@
<version>2.0.0</version> <version>2.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-crm-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -182,6 +188,8 @@
<!--政府端小程序配置--> <!--政府端小程序配置-->
<gov.wx.ma.appId>wx3d1372029eb816a3</gov.wx.ma.appId> <gov.wx.ma.appId>wx3d1372029eb816a3</gov.wx.ma.appId>
<gov.wx.ma.secret>651f02d71ed3f123dfb584b8bf0f4d8b</gov.wx.ma.secret> <gov.wx.ma.secret>651f02d71ed3f123dfb584b8bf0f4d8b</gov.wx.ma.secret>
<!--<gov.wx.ma.appId>wx2679392c4cc2af22</gov.wx.ma.appId>
<gov.wx.ma.secret>e5e72147737cfeb2b0f3a43624cadb3f</gov.wx.ma.secret>-->
</properties> </properties>
</profile> </profile>

14
epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java

@ -9,6 +9,7 @@ import com.epmet.constant.PublicUserLoginConstant;
import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.LoginByPhoneFormDTO;
import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.form.PublicSendSmsCodeFormDTO; import com.epmet.dto.form.PublicSendSmsCodeFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.PublicUserLoginService; import com.epmet.service.PublicUserLoginService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -70,5 +71,18 @@ public class PublicUserLoginController {
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO)); return new Result<UserTokenResultDTO>().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO));
} }
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
@PostMapping(value = "/register")
public Result<UserTokenResultDTO> register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class);
formDTO.setUserId(tokenDTO.getUserId());
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.register(formDTO));
}
} }

14
epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java

@ -3,6 +3,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.LoginFormDTO; import com.epmet.dto.form.LoginFormDTO;
import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.ThirdLoginService; import com.epmet.service.ThirdLoginService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -46,4 +47,17 @@ public class ThirdLoginController {
return new Result<UserTokenResultDTO>().ok(thirdLoginService.workLogin(formDTO)); return new Result<UserTokenResultDTO>().ok(thirdLoginService.workLogin(formDTO));
} }
/**
* @param formDTO
* @return
* @Author sun
* @Description 单客户-选择组织进入首页
**/
@PostMapping(value = "enterorg")
public Result<UserTokenResultDTO> enterOrg(@RequestBody ThirdWxmpEnteOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,ThirdWxmpEnteOrgFormDTO.AddUserShowGroup.class,ThirdWxmpEnteOrgFormDTO.AddUserInternalGroup.class);
UserTokenResultDTO userTokenResultDTO=thirdLoginService.enterOrg(formDTO);
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
} }

6
epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java

@ -38,5 +38,11 @@ public class GovWxmpEnteOrgFormDTO implements Serializable {
*/ */
@NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class})
private String rootAgencyId; private String rootAgencyId;
/**
* desc:小程序appId
*/
private String appId;
} }

4
epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java

@ -19,5 +19,9 @@ public class GovWxmpFormDTO extends LoginCommonFormDTO implements Serializable {
*/ */
@NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class})
private String wxCode; private String wxCode;
/**
* appId
*/
private String appId;
} }

2
epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java

@ -29,4 +29,6 @@ public class LoginByWxCodeFormDTO extends LoginCommonFormDTO implements Serializ
* 加密算法的初始向量 * 加密算法的初始向量
*/ */
private String iv; private String iv;
private String appId;
} }

2
epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java

@ -32,4 +32,6 @@ public class ResiWxPhoneFormDTO implements Serializable {
*/ */
@NotBlank(message = "iv不能为空",groups = {AddUserInternalGroup.class}) @NotBlank(message = "iv不能为空",groups = {AddUserInternalGroup.class})
private String iv; private String iv;
private String appId;
} }

47
epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 单客户-选择组织进入首页入参Dto
* @Author sun
*/
@Data
public class ThirdWxmpEnteOrgFormDTO implements Serializable {
public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {}
/**
* wxCode
*/
@NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class})
private String wxCode;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空",groups = {AddUserShowGroup.class})
private String mobile;
/**
* 选择的组织所属的id
*/
@NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class})
private String customerId;
/**
* 选择的要进入的组织(根组织id)
*/
@NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class})
private String rootAgencyId;
/**
* 客户appIdexJson文件中获取
*/
@NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class})
private String appId;
}

117
epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java

@ -0,0 +1,117 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.redis;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAppDTO;
import com.epmet.dto.CustomerAppRedisDTO;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.google.common.collect.Maps;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 客户app Redis
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Component
public class CustomerAppWxServiceUtil implements ApplicationRunner {
private static Logger logger = LogManager.getLogger(CustomerAppWxServiceUtil.class);
/**
* 过期时长为30分钟单位
*/
private final static long MINUTE_THIRTY_EXPIRE = 60 * 60 * 24 * 7L;
private final static String JSON_STR = "JSON";
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
private static Map<String, WxMaService> maServices = Maps.newConcurrentMap();
public static WxMaService getWxMaService(String appId) {
WxMaService wxMaService = maServices.get(appId);
if (wxMaService == null) {
logger.error("getMaService appId:{} is not config from customer_app", appId);
}
return wxMaService;
}
@Override
public void run(ApplicationArguments args) {
Map<String, WxMaService> maServicesNew = Maps.newConcurrentMap();
SetOperations appSet = null;
List<CustomerAppDTO> result = null;
String appKey = RedisKeys.getCustomerAppKey();
try {
appSet = redisTemplate.opsForSet();
Set<CustomerAppRedisDTO> members = appSet.members(appKey);
if (!CollectionUtils.isEmpty(members)) {
members.forEach(app -> {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid(app.getAppId());
config.setSecret(app.getSecret());
config.setMsgDataFormat(JSON_STR);
WxMaService service = new WxMaServiceImpl();
service.setWxMaConfig(config);
maServicesNew.put(app.getAppId(), service);
});
}
} catch (Exception ex) {
logger.error("init wxMaService from redis error", ex);
}
try {
Result<List<CustomerAppDTO>> configAllAppResult = operCrmOpenFeignClient.getConfigAllApp();
logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp result:{}", JSON.toJSONString(configAllAppResult));
if (configAllAppResult == null || !configAllAppResult.success()) {
logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp fail");
return;
}
result = configAllAppResult.getData();
result.forEach(app -> {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid(app.getAppId());
config.setSecret(app.getSecret());
config.setMsgDataFormat(JSON_STR);
WxMaService service = new WxMaServiceImpl();
service.setWxMaConfig(config);
maServicesNew.put(app.getAppId(), service);
});
} catch (Exception e) {
logger.error("init wxMaService from db exception", e);
}
if (maServicesNew.size() > 0) {
maServices = maServicesNew;
if (appSet != null && result != null) {
appSet.add(appKey, result);
}
}
}
}

3
epmet-auth/src/main/java/com/epmet/service/LoginService.java

@ -45,11 +45,12 @@ public interface LoginService {
* @return cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult * @return cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult
* @param app * @param app
* @param wxCode * @param wxCode
* @param appId 非必填
* @Author yinzuomei * @Author yinzuomei
* @Description 解析wxCode * @Description 解析wxCode
* @Date 2020/4/19 0:24 * @Date 2020/4/19 0:24
**/ **/
WxMaJscode2SessionResult getWxMaUser(String app, String wxCode); WxMaJscode2SessionResult getWxMaUser(String app, String wxCode, String appId);
/** /**
* @return java.lang.String * @return java.lang.String

9
epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.LoginByPhoneFormDTO;
import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.form.PublicSendSmsCodeFormDTO; import com.epmet.dto.form.PublicSendSmsCodeFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
/** /**
@ -38,4 +39,12 @@ public interface PublicUserLoginService {
**/ **/
UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO); UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
UserTokenResultDTO register(RegisterFormDTO formDTO);
} }

9
epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java

@ -1,6 +1,7 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.dto.form.LoginFormDTO; import com.epmet.dto.form.LoginFormDTO;
import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO;
import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.dto.result.UserTokenResultDTO;
/** /**
@ -24,4 +25,12 @@ public interface ThirdLoginService {
* @Description 单客户-政府端微信小程序登录 * @Description 单客户-政府端微信小程序登录
**/ **/
UserTokenResultDTO workLogin(LoginFormDTO formDTO); UserTokenResultDTO workLogin(LoginFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 单客户-选择组织进入首页
**/
UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO);
} }

14
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -21,10 +21,7 @@ import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.*;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils; import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.CaptchaRedis; import com.epmet.redis.CaptchaRedis;
@ -67,6 +64,8 @@ public class GovLoginServiceImpl implements GovLoginService {
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired @Autowired
private EpmetUserOpenFeignClient userOpenFeignClient; private EpmetUserOpenFeignClient userOpenFeignClient;
@Autowired
private EpmetThirdFeignClient epmetThirdFeignClient;
/** /**
* @param formDTO * @param formDTO
@ -141,7 +140,7 @@ public class GovLoginServiceImpl implements GovLoginService {
@Override @Override
public UserTokenResultDTO loginByWxCode(GovWxmpFormDTO formDTO) { public UserTokenResultDTO loginByWxCode(GovWxmpFormDTO formDTO) {
//1、解析微信用户 //1、解析微信用户
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode()); WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode(), formDTO.getAppId());
if(null!=wxMaJscode2SessionResult){ if(null!=wxMaJscode2SessionResult){
logger.info(String.format("app=%s,wxCode=%s,openId=%s",formDTO.getApp(),formDTO.getWxCode(),wxMaJscode2SessionResult.getOpenid())); logger.info(String.format("app=%s,wxCode=%s,openId=%s",formDTO.getApp(),formDTO.getWxCode(),wxMaJscode2SessionResult.getOpenid()));
} }
@ -273,7 +272,8 @@ public class GovLoginServiceImpl implements GovLoginService {
} }
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
//2、解析微信用户 //2、解析微信用户
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode(), formDTO.getAppId());
//3、记录staff_wechat,并记录用户激活状态,激活时间 //3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//4、记录登录日志 //4、记录登录日志
@ -437,7 +437,7 @@ public class GovLoginServiceImpl implements GovLoginService {
govTokenDto.setUserId(staffId); govTokenDto.setUserId(staffId);
govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid());
govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey());
govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); govTokenDto.setUnionId(null == wxMaJscode2SessionResult.getUnionid() ? "" : wxMaJscode2SessionResult.getUnionid());
govTokenDto.setToken(token); govTokenDto.setToken(token);
govTokenDto.setUpdateTime(System.currentTimeMillis()); govTokenDto.setUpdateTime(System.currentTimeMillis());
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());

37
epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java

@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import com.alibaba.fastjson.JSON;
import com.epmet.common.token.constant.LoginConstant; import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -22,6 +23,7 @@ import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.OperAccessOpenFeignClient; import com.epmet.feign.OperAccessOpenFeignClient;
import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils; import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.CustomerAppWxServiceUtil;
import com.epmet.service.CaptchaService; import com.epmet.service.CaptchaService;
import com.epmet.service.LoginService; import com.epmet.service.LoginService;
import com.epmet.utils.WxMaServiceUtils; import com.epmet.utils.WxMaServiceUtils;
@ -82,7 +84,7 @@ public class LoginServiceImpl implements LoginService {
throw new RenException("参数错误"); throw new RenException("参数错误");
} }
//1、根据wxCode获取微信信息 //1、根据wxCode获取微信信息
WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO.getApp(),formDTO.getWxCode()); WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO.getApp(),formDTO.getWxCode(),formDTO.getAppId());
logger.info("openId=[" + wxMaJscode2SessionResult.getOpenid() + "]unionId=[" + wxMaJscode2SessionResult.getUnionid() + "]"); logger.info("openId=[" + wxMaJscode2SessionResult.getOpenid() + "]unionId=[" + wxMaJscode2SessionResult.getUnionid() + "]");
//2、根据openId查询数据库,没有则直接插入一条记录 //2、根据openId查询数据库,没有则直接插入一条记录
String userId = this.getUserId(formDTO, wxMaJscode2SessionResult); String userId = this.getUserId(formDTO, wxMaJscode2SessionResult);
@ -109,21 +111,29 @@ public class LoginServiceImpl implements LoginService {
* @date 2020/3/14 20:16 * @date 2020/3/14 20:16
*/ */
@Override @Override
public WxMaJscode2SessionResult getWxMaUser(String app,String wxCode) { public WxMaJscode2SessionResult getWxMaUser(String app,String wxCode,String appId) {
WxMaJscode2SessionResult wxMaJscode2SessionResult = null; WxMaJscode2SessionResult wxMaJscode2SessionResult = null;
try { try {
if (LoginConstant.APP_GOV.equals(app)) { if (StringUtils.isNotBlank(appId)){
wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(wxCode); WxMaService wxMaService = CustomerAppWxServiceUtil.getWxMaService(appId);
} else if (LoginConstant.APP_OPER.equals(app)) { if (wxMaService == null){
wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(wxCode); throw new RenException("解析微信用户信息失败");
} else if (LoginConstant.APP_RESI.equals(app)) { }
wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode); wxMaJscode2SessionResult = wxMaService.jsCode2SessionInfo(wxCode);
}else{
if (LoginConstant.APP_GOV.equals(app)) {
wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(wxCode);
} else if (LoginConstant.APP_OPER.equals(app)) {
wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(wxCode);
} else if (LoginConstant.APP_RESI.equals(app)) {
wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode);
}
} }
} catch (WxErrorException e) { } catch (WxErrorException e) {
log.error("->[getMaOpenId]::error[{}]", "解析微信code失败"); log.error("->[getMaOpenId]::error[{}]", "解析微信code失败",e);
} }
if (null == wxMaJscode2SessionResult) { if (null == wxMaJscode2SessionResult) {
log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s]",app,wxCode)); log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult)));
throw new RenException("解析微信用户信息失败"); throw new RenException("解析微信用户信息失败");
} else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) { } else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) {
log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode)); log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode));
@ -137,7 +147,12 @@ public class LoginServiceImpl implements LoginService {
String phone=""; String phone="";
try { try {
ValidatorUtils.validateEntity(formDTO, ResiWxPhoneFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO, ResiWxPhoneFormDTO.AddUserInternalGroup.class);
WxMaService wxMaService = wxMaServiceUtils.resiWxMaService(); WxMaService wxMaService = null;
if (StringUtils.isNotBlank(formDTO.getAppId())){
wxMaService = CustomerAppWxServiceUtil.getWxMaService(formDTO.getAppId());
}else{
wxMaService = wxMaServiceUtils.resiWxMaService();
}
WxMaJscode2SessionResult wxMaJscode2SessionResult = wxMaService.jsCode2SessionInfo(formDTO.getWxCode()); WxMaJscode2SessionResult wxMaJscode2SessionResult = wxMaService.jsCode2SessionInfo(formDTO.getWxCode());
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService().getPhoneNoInfo(wxMaJscode2SessionResult.getSessionKey(), WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService().getPhoneNoInfo(wxMaJscode2SessionResult.getSessionKey(),
formDTO.getEncryptedData(), formDTO.getEncryptedData(),

44
epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java

@ -1,8 +1,10 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.epmet.common.token.constant.LoginConstant; import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
@ -14,10 +16,7 @@ import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PaUserDTO; import com.epmet.dto.PaUserDTO;
import com.epmet.dto.PaUserWechatDTO; import com.epmet.dto.PaUserWechatDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerUserResultDTO; import com.epmet.dto.result.*;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.dto.result.SendVerificationCodeResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetThirdFeignClient; import com.epmet.feign.EpmetThirdFeignClient;
import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenProperties;
@ -33,8 +32,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -100,6 +101,10 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
logger.error("wxMpUser is null"); logger.error("wxMpUser is null");
throw new RenException("解析微信用户信息失败 wxMpUser is null"); throw new RenException("解析微信用户信息失败 wxMpUser is null");
} }
if(StringUtils.isBlank(wxMpUser.getOpenId())){
logger.error("wxMpUser.getOpenId() is null");
throw new RenException("解析微信用户信息失败");
}
/*if(StringUtils.isBlank(wxMpUser.getUnionId())){ /*if(StringUtils.isBlank(wxMpUser.getUnionId())){
logger.error("wxMpUser.getUnionId() is null"); logger.error("wxMpUser.getUnionId() is null");
// throw new RenException("解析微信用户信息失败"); // throw new RenException("解析微信用户信息失败");
@ -242,4 +247,35 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
return userTokenResultDTO; return userTokenResultDTO;
} }
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
@Override
public UserTokenResultDTO register(RegisterFormDTO formDTO) {
//1.调用epmet-third服务,完成信息注册
Result<RegisterResultDTO> result = epmetThirdFeignClient.register(formDTO);
if (!result.success()) {
logger.error("调用epmet_third服务初始化用户信息失败");
throw new RenException(result.getCode());
}
RegisterResultDTO resultDTO = result.getData();
//2.直接生成一个新的token放入缓存中(不管缓存中是否存在旧的token,都重新生成)
//2-1.生成token
String token = this.generateGovWxmpToken(resultDTO.getUserId());
//2-2.token存入redis
String openid = resultDTO.getOpenId();
String unionId = (null == resultDTO.getUnionId() ? "" : resultDTO.getUnionId());
this.saveLatestGovTokenDto("", resultDTO.getUserId(), openid, unionId, token);
//3.返回token
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
} }

102
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.epmet.common.token.constant.LoginConstant; import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
@ -10,10 +11,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.*;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.DepartmentListResultDTO; import com.epmet.dto.result.DepartmentListResultDTO;
import com.epmet.dto.result.GridByStaffResultDTO; import com.epmet.dto.result.GridByStaffResultDTO;
@ -347,4 +345,100 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
return null; return null;
} }
/**
* @param formDTO
* @return
* @Author sun
* @Description 单客户-选择组织进入首页
**/
@Override
public UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO) {
//1、需要校验要登录的客户,是否被禁用
CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO();
customerStaffFormDTO.setCustomerId(formDTO.getCustomerId());
customerStaffFormDTO.setMobile(formDTO.getMobile());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfo(customerStaffFormDTO);
if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) {
logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
throw new RenException(customerStaffDTOResult.getCode());
}
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
//2020.7.24 获取微信信息接口调整,改调用微信api的方式 sun start
//2.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO();
resiLoginFormDTO.setAppId(formDTO.getAppId());
resiLoginFormDTO.setWxCode(formDTO.getWxCode());
Result<UserWechatDTO> result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO);
if (!result.success()) {
logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败");
throw new RenException(result.getCode());
}
UserWechatDTO userWechatDTO = result.getData();
WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult();
wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId());
wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey());
wxMaJscode2SessionResult.setUnionid("");
// end
//3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//4、记录登录日志
this.saveGovStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//5.2、保存到redis
this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
//保存登录日志
private Result saveGovStaffLoginRecord(ThirdWxmpEnteOrgFormDTO formDTO, String staffId, String openId) {
StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO();
staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId());
staffLoginAgencyRecordFormDTO.setStaffId(staffId);
staffLoginAgencyRecordFormDTO.setWxOpenId(openId);
staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile());
staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getRootAgencyId());
Result staffLoginRecordResult = epmetUserOpenFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO);
return staffLoginRecordResult;
}
/**
* @Description 生成token
* @Date 2020/4/18 23:04
**/
private void saveGovTokenDto(String orgId,
String customerId,
String staffId,
WxMaJscode2SessionResult wxMaJscode2SessionResult,
String token) {
int expire = jwtTokenProperties.getExpire();
GovTokenDto govTokenDto = new GovTokenDto();
govTokenDto.setApp(LoginConstant.APP_GOV);
govTokenDto.setClient(LoginConstant.CLIENT_WXMP);
govTokenDto.setUserId(staffId);
govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid());
govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey());
govTokenDto.setUnionId(null == wxMaJscode2SessionResult.getUnionid() ? "" : wxMaJscode2SessionResult.getUnionid());
govTokenDto.setToken(token);
govTokenDto.setUpdateTime(System.currentTimeMillis());
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
govTokenDto.setRootAgencyId(orgId);
govTokenDto.setCustomerId(customerId);
//设置部门,网格,角色列表
govTokenDto.setDeptIdList(getDeptartmentIdList(staffId));
govTokenDto.setGridIdList(getGridIdList(staffId));
CustomerAgencyDTO agency = getAgencyByStaffId(staffId);
if (agency != null) {
govTokenDto.setAgencyId(agency.getId());
govTokenDto.setRoleList(queryGovStaffRoles(staffId, agency.getId()));
}
govTokenDto.setOrgIdPath(getOrgIdPath(staffId));
cpUserDetailRedis.set(govTokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
}
} }

20
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java

@ -0,0 +1,20 @@
package com.epmet.commons.tools.constant;
/**
* 消息常亮
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/27 9:58
*/
public interface MqConstant {
/**
* 加分 plus
*/
String PLUS="plus";
/**
* 减分标识 minus
*/
String MINUS="minus";
}

25
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java

@ -48,4 +48,29 @@ public interface StrConstant {
* 中文顿号 * 中文顿号
*/ */
String COMMA_ZH = "、"; String COMMA_ZH = "、";
/**
* 反斜杠
*/
String SEPARATOR = "/";
/**
* true
*/
String TRUE = "true";
/**
* true
*/
String FALSE = "false";
/**
* *
*/
String STAR="*";
/**
* 空字符串
*/
String EPMETY_STR="";
} }

41
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java

@ -0,0 +1,41 @@
package com.epmet.commons.tools.dto.form.mq;
import lombok.Data;
import java.io.Serializable;
/**
* desc消息网关事件类型dto
*
* @author lyn
* @date 2020/7/24 18:30
*/
@Data
public class EventClassDto implements Serializable {
private static final long serialVersionUID = 6923860669547819790L;
/**
* appId
*/
private String appId;
/**
* 事件类型Id
*/
private Integer id;
/**
* 事件标识
*/
private String eventClass;
/**
* 事件名称
*/
private String eventClassName;
/**
* 0''未删''1''已删
*/
private Integer delFlag;
/**
* 事件计数
*/
private Integer eventCount;
}

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java

@ -3,6 +3,8 @@ package com.epmet.commons.tools.dto.form.mq;
import lombok.Data; import lombok.Data;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.validation.constraints.NotBlank;
/** /**
* 消息网关基础信息 * 消息网关基础信息
* *
@ -11,20 +13,23 @@ import org.springframework.stereotype.Component;
**/ **/
@Data @Data
@Component @Component
public class MqBaseMsgDTO extends MqConfigDTO { public class MqBaseMsgDTO extends MqBaseParamDTO {
private static final long serialVersionUID = 8176470786428432009L; private static final long serialVersionUID = 8176470786428432009L;
/** /**
* mq的事件类型 * mq的事件类型
*/ */
@NotBlank(message = "事件类型不能为空")
private String eventClass; private String eventClass;
/** /**
* 事件code * 事件code
*/ */
@NotBlank(message = "事件标识不能为空")
private String eventTag; private String eventTag;
/** /**
* 消息体 * 消息体
*/ */
@NotBlank(message = "消息体不能为空")
private String msg; private String msg;
} }

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java → epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java

@ -11,7 +11,7 @@ import java.io.Serializable;
* @date 2020-07-21 14:33 * @date 2020-07-21 14:33
**/ **/
@Data @Data
public class MqConfigDTO implements Serializable { public class MqBaseParamDTO implements Serializable {
private String appId; private String appId;
private String token; private String token;
private String requestUrl; private String requestUrl;

18
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java

@ -0,0 +1,18 @@
package com.epmet.commons.tools.dto.form.mq.eventmsg;
import lombok.Data;
/**
* 结束活动发放活动积分消息体
*
* @author yinzuomei@elink-cn.com
* @date 2020/7/27 9:26
*/
@Data
public class ActPointEventMsg extends BasePointEventMsg{
/**
* 参与活动的备注
*/
private String remark;
}

45
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java

@ -0,0 +1,45 @@
package com.epmet.commons.tools.dto.form.mq.eventmsg;
import lombok.Data;
import java.io.Serializable;
/**
* desc积分相关事件消息体
*
* @author lyn
* @date 2020/7/23 16:34
*/
@Data
public class BasePointEventMsg implements Serializable {
private static final long serialVersionUID = 4037225404113743943L;
/**
* 操作人机关id
*/
private String opAgencyId;
/**
* 客户Id
*/
private String customerId;
/**
* 被操作用户id
*/
private String userId;
/**
* 加减分标识 plus/minus
*/
private String actionFlag;
/**
* 积分值
*/
private Integer point;
/**
* 是否是通用事件通用事件不走规则
*/
private Boolean isCommon;
}

42
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java

@ -0,0 +1,42 @@
package com.epmet.commons.tools.enums;
/**
* 通用操作类型 枚举类
* dev|test|prod
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum CommonOperateTypeEnum {
ADD("add", "添加"),
EDIT("edit", "编辑"),
DEL("del", "删除"),
;
private String code;
private String desc;
CommonOperateTypeEnum(String code, String name) {
this.code = code;
this.desc = name;
}
public static CommonOperateTypeEnum getEnum(String code) {
CommonOperateTypeEnum[] values = CommonOperateTypeEnum.values();
for (CommonOperateTypeEnum value : values) {
if (code != null && value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

47
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java

@ -0,0 +1,47 @@
package com.epmet.commons.tools.enums;
/**
* 系统支持的事件枚举类
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum EventEnum {
ACTIVE_SEND_POINT("active_send_point", "epmet_heart", "活动发放积分"),
REGISTER_VOLUNTEER("register_volunteer", "epmet_heart", "认证志愿者"),
ACTIVE_INSERT_LIVE("active_insert_live", "epmet_heart", "添加活动实况"),
;
private String eventClass;
private String eventTag;
private String eventDesc;
EventEnum(String eventTag, String eventClass, String eventDesc) {
this.eventTag = eventTag;
this.eventClass = eventClass;
this.eventDesc = eventDesc;
}
public static EventEnum getEnum(String eventCode) {
EventEnum[] values = EventEnum.values();
for (EventEnum value : values) {
if (eventCode != null && value.getEventTag().equals(eventCode)) {
return value;
}
}
return null;
}
public String getEventTag() {
return eventTag;
}
public String getEventClass() {
return eventClass;
}
public String getEventDesc() {
return eventDesc;
}
}

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java

@ -9,6 +9,7 @@ package com.epmet.commons.tools.enums;
**/ **/
public enum MqMethodPathEnum { public enum MqMethodPathEnum {
SEND_MSG("producerService/producer/sendMsg", "发送消息"), SEND_MSG("producerService/producer/sendMsg", "发送消息"),
GET_EVENT_LIST("eventClass/getList", "获取事件类型列表"),
; ;

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -54,6 +54,13 @@ public enum EpmetErrorCode {
ACT_CONTENT_TEXT_SCAN_FAILED(8116,"活动详情内容审核失败,请重新编辑"), ACT_CONTENT_TEXT_SCAN_FAILED(8116,"活动详情内容审核失败,请重新编辑"),
ACT_CONTENT_IMG_SCAN_FAILED(8117,"活动详情图片失败,请重新编辑"), ACT_CONTENT_IMG_SCAN_FAILED(8117,"活动详情图片失败,请重新编辑"),
ACT_COVER_PIC_SCAN_FAILED(8118,"活动封面图片审核失败,请重新编辑"), ACT_COVER_PIC_SCAN_FAILED(8118,"活动封面图片审核失败,请重新编辑"),
ACT_START_TIME_ERROR(8119,"活动预计开始时间应早于活动预计结束时间"),
ACT_SIGN_IN_START_TIME_ERROR(8120,"签到开始时间应早于签到结束时间"),
ACT_SIGN_UP_END_TIME_ERROR(8121,"活动报名截止时间应早于活动预计开始时间"),
ACT_ACTUAL_START_TIME_ERROR(8122,"实际开始时间应早于实际结束时间"),
HAVE_HANDLE(8123,"存在待处理事项,请先处理"),
ACTUAL_TIME(8124,"请录入实际开始时间,实际结束时间"),
ACTUAL_NOT_FINISHED(8125,"请先结束活动"),
CANNOT_AUDIT_WARM(8201, "请完善居民信息"), CANNOT_AUDIT_WARM(8201, "请完善居民信息"),
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"),
@ -74,6 +81,11 @@ public enum EpmetErrorCode {
IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"), IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"),
PROJECT_IS_CLOSED(8601,"项目已结案"), PROJECT_IS_CLOSED(8601,"项目已结案"),
// 爱心互助 居民端
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),
NON_CERTIFIED_VOLUNTEER(8511, "活动报名失败,请先认证志愿者"),
ACT_TIME_CONFLICT(8512, "活动时间冲突"),
// 该错误不会提示给前端,只是后端传输错误信息用。 // 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),
OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"), OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"),

8
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -254,6 +254,14 @@ public class RedisKeys {
return rootPrefix.concat("tags:grid:relationTag:").concat(gridId).concat(StrConstant.COLON).concat(tagId); return rootPrefix.concat("tags:grid:relationTag:").concat(gridId).concat(StrConstant.COLON).concat(tagId);
} }
/**
* appId secret 缓存Key
* @return
*/
public static String getCustomerAppKey() {
return rootPrefix.concat("oper:crm:app");
}
/** /**
* 获取生成的用户标识 缓存Key * 获取生成的用户标识 缓存Key
* @param shortUserId * @param shortUserId

22
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -341,12 +341,12 @@ public class DateUtils {
return DateUtils.addDateDays(nextMonth, -1); return DateUtils.addDateDays(nextMonth, -1);
} }
public static void main(String[] args) { // public static void main(String[] args) {
//int weekOfYear = getWeekOfYear(new Date()); // //int weekOfYear = getWeekOfYear(new Date());
String format = String.format("%02d", 9); // String format = String.format("%02d", 9);
//
System.out.println(666); // System.out.println(666);
} // }
/** /**
* 获取日期前一天 * 获取日期前一天
@ -485,7 +485,7 @@ public class DateUtils {
public static String formatTimestamp(Long timestamp, String pattern) { public static String formatTimestamp(Long timestamp, String pattern) {
//设置格式 //设置格式
SimpleDateFormat format = new SimpleDateFormat(pattern); SimpleDateFormat format = new SimpleDateFormat(pattern);
return format.format(timestamp); return format.format(timestamp * 1000);
} }
public static Date minStrToSecondDate(String minStr){ public static Date minStrToSecondDate(String minStr){
@ -502,4 +502,12 @@ public class DateUtils {
return null; return null;
} }
public static Integer calculateMin(Date startDate,Date endDate){
long start=startDate.getTime();
long end=endDate.getTime();
// 计算差多少分钟
int minutes = (int) ((end - start) / (1000 * 60));
System.out.println("两个时间之间的分钟差为:" + minutes);
return minutes;
}
} }

37
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java

@ -0,0 +1,37 @@
package com.epmet.commons.tools.utils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
public class FileUtils {
/**
* 创建临时文件.
*
* @param inputStream 输入文件流
* @param name 文件名
* @param ext 扩展名
* @param tmpDirFile 临时文件夹目录
*/
public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException {
File resultFile = File.createTempFile(name, '.' + ext, tmpDirFile);
resultFile.deleteOnExit();
org.apache.commons.io.FileUtils.copyToFile(inputStream, resultFile);
return resultFile;
}
/**
* 创建临时文件.
*
* @param inputStream 输入文件流
* @param name 文件名
* @param ext 扩展名
*/
public static File createTmpFile(InputStream inputStream, String name, String ext) throws IOException {
return createTmpFile(inputStream, name, ext, Files.createTempDirectory("weixin-java-tools-temp").toFile());
}
}

97
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java

@ -6,7 +6,6 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
@ -23,9 +22,10 @@ import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity; import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
@ -43,6 +43,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
@ -170,11 +171,20 @@ public class HttpClientManager {
try { try {
HttpPost httppost = new HttpPost(url); HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig); httppost.setConfig(requestConfig);
httppost.addHeader("Content-Type", "application/json; charset=utf-8"); String boundaryStr = "------------" + System.currentTimeMillis();
FileBody fileBody = new FileBody(file); httppost.addHeader("Connection", "keep-alive");
HttpEntity reqEntity = MultipartEntityBuilder.create() httppost.addHeader("Accept", "*/*");
.addPart("media", fileBody).build(); httppost.addHeader("Content-Type", "multipart/form-data;boundary=" + boundaryStr);
httppost.setEntity(reqEntity); httppost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
MultipartEntityBuilder meb = MultipartEntityBuilder.create();
meb.setBoundary(boundaryStr).setCharset(StandardCharsets.UTF_8).setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
meb.addBinaryBody("media", file, ContentType.APPLICATION_OCTET_STREAM, file.getName());
HttpEntity entity = meb.build();
httppost.setEntity(entity);
// FileBody fileBody = new FileBody(file);
// HttpEntity reqEntity = MultipartEntityBuilder.create()
// .addPart("media", fileBody).build();
// httppost.setEntity(reqEntity);
return execute(httppost,false); return execute(httppost,false);
} catch (Exception e) { } catch (Exception e) {
log.error("send exception", e); log.error("send exception", e);
@ -295,6 +305,7 @@ public class HttpClientManager {
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
} }
/** /**
* desc: 发送get请求 * desc: 发送get请求
* param:url, params * param:url, params
@ -303,7 +314,7 @@ public class HttpClientManager {
* *
* @author: jianjun liu * @author: jianjun liu
*/ */
public Result<Byte[]> sendGetFile(String url, Map<String, Object> params) { public Result<byte[]> getByteArray(String url, Map<String, Object> params) {
try { try {
URIBuilder builder = new URIBuilder(url); URIBuilder builder = new URIBuilder(url);
@ -318,11 +329,71 @@ public class HttpClientManager {
return executeToByte(httpGet); return executeToByte(httpGet);
} catch (Exception e) { } catch (Exception e) {
log.error("sendGet exception", e); log.error("sendGet exception", e);
return new Result<Byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); return new Result<byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
private Result<byte[]> executeToByte(HttpRequestBase httpMethod) {
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpMethod);
log.debug("http send response:{}", JSON.toJSONString(response));
if (response != null && response.getStatusLine() != null) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
InputStream in = response.getEntity().getContent();
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int n = 0;
while (-1 != (n = in.read(buffer))) {
output.write(buffer, 0, n);
}
// return new Result<byte[]>().ok(ArrayUtils.toObject(output.toByteArray()));
return new Result<byte[]>().ok(output.toByteArray());
} else {
log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
}
}
} catch (Exception e) {
log.error("execute exception", e);
return new Result<byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} finally {
httpMethod.releaseConnection();
try {
if (response != null) {
response.close();
}
} catch (IOException e) {
}
}
return new Result<byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
/**
* 获取下载文件的字节数组
* @param url
* @param params
* @return
*/
public Result<byte[]> getDownloadFilebytes(String url, Map<String, Object> params) {
try {
URIBuilder builder = new URIBuilder(url);
if (!CollectionUtils.isEmpty(params)) {
Set<String> set = params.keySet();
for (String key : set) {
builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key)));
}
}
HttpGet httpGet = new HttpGet(builder.build());
httpGet.setConfig(requestConfig);
return executeTobyte(httpGet);
} catch (Exception e) {
log.error("sendGet exception", e);
return new Result<byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
} }
} }
private Result<Byte[]> executeToByte(HttpRequestBase httpMethod) { private Result<byte[]> executeTobyte(HttpRequestBase httpMethod) {
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
try { try {
response = httpclient.execute(httpMethod); response = httpclient.execute(httpMethod);
@ -336,14 +407,14 @@ public class HttpClientManager {
while (-1 != (n = in.read(buffer))) { while (-1 != (n = in.read(buffer))) {
output.write(buffer, 0, n); output.write(buffer, 0, n);
} }
return new Result<Byte[]>().ok(ArrayUtils.toObject(output.toByteArray())); return new Result<byte[]>().ok(output.toByteArray());
} else { } else {
log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("execute exception", e); log.error("execute exception", e);
return new Result<Byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); return new Result<byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} finally { } finally {
httpMethod.releaseConnection(); httpMethod.releaseConnection();
try { try {
@ -353,7 +424,7 @@ public class HttpClientManager {
} catch (IOException e) { } catch (IOException e) {
} }
} }
return new Result<Byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); return new Result<byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
} }
private static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException { private static SSLContext createIgnoreVerifySSL() throws NoSuchAlgorithmException, KeyManagementException {

59
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java

@ -4,14 +4,21 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.config.MqConfig; import com.epmet.commons.tools.config.MqConfig;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.EventClassDto;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult; import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult;
import com.epmet.commons.tools.enums.MqMethodPathEnum; import com.epmet.commons.tools.enums.MqMethodPathEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 发送亿联云消息工具类 * 发送亿联云消息工具类
* *
@ -21,7 +28,7 @@ import org.springframework.stereotype.Component;
@Slf4j @Slf4j
@Component @Component
public class SendMqMsgUtils { public class SendMqMsgUtils {
private static MqConfig mqStaticConfig; private static MqConfig mqConfig;
/** /**
* desc:发送mq消息 * desc:发送mq消息
@ -29,19 +36,19 @@ public class SendMqMsgUtils {
* @return * @return
*/ */
public static Result<String> sendMsg(MqBaseMsgDTO msg) { public static Result<String> sendMsg(MqBaseMsgDTO msg) {
if (mqStaticConfig == null) { if (mqConfig == null) {
mqStaticConfig = SpringContextUtils.getBean(MqConfig.class); mqConfig = SpringContextUtils.getBean(MqConfig.class);
} }
log.debug("sendMsg param:{}", JSON.toJSONString(msg)); log.debug("sendMsg param:{}", JSON.toJSONString(msg));
try { try {
// TODO // TODO
//ValidatorUtils.validateEntity(msg, null); ValidatorUtils.validateEntity(msg, DefaultGroup.class);
} catch (ValidateException e) { } catch (ValidateException e) {
return new Result<String>().error(e.getMsg()); return new Result<String>().error(e.getMsg());
} }
msg.setAppId(mqStaticConfig.getAppId()); msg.setAppId(mqConfig.getAppId());
msg.setRequestUrl(mqStaticConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode())); msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode()));
msg.setToken(mqStaticConfig.getToken()); msg.setToken(mqConfig.getToken());
try { try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg)); Result<String> result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg));
log.debug("sendMsg result:{}", JSON.toJSONString(result)); log.debug("sendMsg result:{}", JSON.toJSONString(result));
@ -66,4 +73,42 @@ public class SendMqMsgUtils {
} }
/**
* desc:发送mq消息
*
* @return
*/
public static Result<List<EventClassDto>> getEventClassList() {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
Map<String, String> param = new HashMap<>();
param.put("appId", mqConfig.getAppId());
param.put("token", mqConfig.getToken());
String requestUrl = mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode());
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(param));
log.debug("getEventClassList result:{}", JSON.toJSONString(result));
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
List<EventClassDto> eventClassDto = JSON.parseArray(resultResult.getData(), EventClassDto.class);
return new Result<List<EventClassDto>>().ok(eventClassDto);
} else {
log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult));
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg());
}
}
Result<List<EventClassDto>> resultResult = new Result<>();
resultResult.error(result.getCode(), result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.debug("sendMsg exception", e);
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
} }

2
epmet-gateway/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services: services:
epmet-gateway-server: epmet-gateway-server:
container_name: epmet-gateway-server-dev container_name: epmet-gateway-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.27 image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.28
ports: ports:
- "8080:8080" - "8080:8080"
network_mode: host # 使用现有网络 network_mode: host # 使用现有网络

2
epmet-gateway/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services: services:
epmet-gateway-server: epmet-gateway-server:
container_name: epmet-gateway-server-prod container_name: epmet-gateway-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.25 image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.26
ports: ports:
- "8080:8080" - "8080:8080"
network_mode: host # 使用现有网络 network_mode: host # 使用现有网络

9
epmet-gateway/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> 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> <modelVersion>4.0.0</modelVersion>
<version>0.3.27</version> <version>0.3.28</version>
<parent> <parent>
<groupId>com.epmet</groupId> <groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId> <artifactId>epmet-cloud</artifactId>
@ -108,7 +108,7 @@
<nacos.ip></nacos.ip> <nacos.ip></nacos.ip>
<!-- gateway routes --> <!-- gateway routes -->
<!-- 1、认证服务 --> <!-- 1、认证服务 -->
<!-- <gateway.routes.epmet-auth-server.uri>http://localhost:8081</gateway.routes.epmet-auth-server.uri>--> <!-- <gateway.routes.epmet-auth-server.uri>http://localhost:8081</gateway.routes.epmet-auth-server.uri>-->
<gateway.routes.epmet-auth-server.uri>lb://epmet-auth-server</gateway.routes.epmet-auth-server.uri> <gateway.routes.epmet-auth-server.uri>lb://epmet-auth-server</gateway.routes.epmet-auth-server.uri>
<!-- 2、Admin服务 --> <!-- 2、Admin服务 -->
<gateway.routes.epmet-admin-server.uri>lb://epmet-admin-server</gateway.routes.epmet-admin-server.uri> <gateway.routes.epmet-admin-server.uri>lb://epmet-admin-server</gateway.routes.epmet-admin-server.uri>
@ -130,6 +130,7 @@
<gateway.routes.oper-customize-server.uri>lb://oper-customize-server</gateway.routes.oper-customize-server.uri> <gateway.routes.oper-customize-server.uri>lb://oper-customize-server</gateway.routes.oper-customize-server.uri>
<!-- 11、运营端客户定制化服务 --> <!-- 11、运营端客户定制化服务 -->
<gateway.routes.oper-crm-server.uri>lb://oper-crm-server</gateway.routes.oper-crm-server.uri> <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、居民端陌生人导览 --> <!-- 12、居民端陌生人导览 -->
<gateway.routes.resi-guide-server.uri>lb://resi-guide-server</gateway.routes.resi-guide-server.uri> <gateway.routes.resi-guide-server.uri>lb://resi-guide-server</gateway.routes.resi-guide-server.uri>
<!-- 13、政府组织管理 --> <!-- 13、政府组织管理 -->
@ -282,7 +283,7 @@
<!-- 32、 爱心互助 --> <!-- 32、 爱心互助 -->
<gateway.routes.epmet-heart-server.url>lb://epmet-heart-server</gateway.routes.epmet-heart-server.url> <gateway.routes.epmet-heart-server.url>lb://epmet-heart-server</gateway.routes.epmet-heart-server.url>
<!-- 33、积分银行 --> <!-- 33、积分银行 -->
<gateway.routes.epmet-point-server.url>http://127.0.0.1:8112</gateway.routes.epmet-point-server.url> <gateway.routes.epmet-point-server.url>lb://epmet-point-server</gateway.routes.epmet-point-server.url>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -367,7 +368,7 @@
<!-- 32、 爱心互助 --> <!-- 32、 爱心互助 -->
<gateway.routes.epmet-heart-server.url>lb://epmet-heart-server</gateway.routes.epmet-heart-server.url> <gateway.routes.epmet-heart-server.url>lb://epmet-heart-server</gateway.routes.epmet-heart-server.url>
<!-- 33、 积分银行 --> <!-- 33、 积分银行 -->
<gateway.routes.epmet-point-server.url>http://127.0.0.1:8112</gateway.routes.epmet-point-server.url> <gateway.routes.epmet-point-server.url>lb://epmet-point-server</gateway.routes.epmet-point-server.url>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>

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

@ -353,6 +353,8 @@ renren:
- /resi/group/** - /resi/group/**
- /resi/partymember/** - /resi/partymember/**
- /gov/grid/** - /gov/grid/**
- /heart/**
- /point/**
management: management:
endpoints: endpoints:
web: web:

2
epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services: services:
data-statistical-server: data-statistical-server:
container_name: data-statistical-server-dev container_name: data-statistical-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.39 image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.41
ports: ports:
- "8108:8108" - "8108:8108"
network_mode: host # 使用现有网络 network_mode: host # 使用现有网络

2
epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml

@ -2,7 +2,7 @@ version: "3.7"
services: services:
data-statistical-server: data-statistical-server:
container_name: data-statistical-server-test container_name: data-statistical-server-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.39 image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.41
ports: ports:
- "8108:8108" - "8108:8108"
network_mode: host # 使用现有网络 network_mode: host # 使用现有网络

2
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>0.3.39</version> <version>0.3.41</version>
<parent> <parent>
<artifactId>data-statistical</artifactId> <artifactId>data-statistical</artifactId>
<groupId>com.epmet</groupId> <groupId>com.epmet</groupId>

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java

@ -43,4 +43,6 @@ public interface CustomerDao extends BaseDao<CustomerEntity> {
List<CustomerEntity> listValidCustomersByCreateTime( List<CustomerEntity> listValidCustomersByCreateTime(
@Param("createTimeFrom") Date createTimeFrom, @Param("createTimeFrom") Date createTimeFrom,
@Param("createTimeTo") Date createTimeTo); @Param("createTimeTo") Date createTimeTo);
List<CustomerEntity> listValidCustomersByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
} }

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java

@ -38,4 +38,5 @@ public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity>
@Param("createdTimeFrom") Date createdTimeFrom, @Param("createdTimeFrom") Date createdTimeFrom,
@Param("createdTimeTo") Date createdTimeTo); @Param("createdTimeTo") Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
} }

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -59,4 +59,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @author zxc * @author zxc
*/ */
List<GridIdListByCustomerResultDTO> getCustomerGridIdList(@Param("customerId") String customerId, @Param("dateId") String dateId); List<GridIdListByCustomerResultDTO> getCustomerGridIdList(@Param("customerId") String customerId, @Param("dateId") String dateId);
/**
* 根据更新时间查询列表
* @param startTime
* @param endTime
* @return
*/
List<CustomerGridEntity> listUpdatedGridsByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -20,4 +20,6 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<AgencySubTreeDto> selectAllAgency(); List<AgencySubTreeDto> selectAllAgency();
List<AgencySubTreeDto> selectSubAgencyByPid(@Param("pid")String pid); List<AgencySubTreeDto> selectSubAgencyByPid(@Param("pid")String pid);
List<CustomerAgencyEntity> listAgenciesByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java

@ -124,4 +124,6 @@ public interface DimAgencyDao extends BaseDao<DimAgencyEntity> {
String getPidByAgencyId(@Param("agencyId") String agencyId); String getPidByAgencyId(@Param("agencyId") String agencyId);
DimAgencyEntity getLatestCreatedAgencyDimEntity(); DimAgencyEntity getLatestCreatedAgencyDimEntity();
DimAgencyEntity getLatestUpdatedAgencyDimEntity();
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java

@ -47,4 +47,6 @@ public interface DimCustomerDao extends BaseDao<DimCustomerEntity> {
void insertOne(DimCustomerEntity dim); void insertOne(DimCustomerEntity dim);
DimCustomerEntity getLatestCreatedDimEntity(); DimCustomerEntity getLatestCreatedDimEntity();
DimCustomerEntity getLatestUpdatedDimEntity();
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java

@ -42,4 +42,6 @@ public interface DimDepartmentDao extends BaseDao<DimDepartmentEntity> {
List<DimDepartmentEntity> getDepartmentListByCustomerId(@Param("customerId") String customerId); List<DimDepartmentEntity> getDepartmentListByCustomerId(@Param("customerId") String customerId);
DimDepartmentEntity getLatestCreatedDimEntity(); DimDepartmentEntity getLatestCreatedDimEntity();
DimDepartmentEntity getLatestUpdatedDimEntity();
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java

@ -58,4 +58,6 @@ public interface DimGridDao extends BaseDao<DimGridEntity> {
* @author zxc * @author zxc
*/ */
List<SubAgencyIdResultDTO> selectSubAgencyId(@Param("formDTO")List<AgencyDTO> formDTO); List<SubAgencyIdResultDTO> selectSubAgencyId(@Param("formDTO")List<AgencyDTO> formDTO);
DimGridEntity getLastUpdatedGridDim();
} }

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java

@ -9,4 +9,5 @@ public interface CustomerService {
List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo); List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo);
List<CustomerEntity> listValidCustomersByUpdatedTime(Date updatedTime, Date initTime);
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java

@ -22,4 +22,9 @@ public class CustomerServiceImpl implements CustomerService {
public List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) { public List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) {
return customerDao.listValidCustomersByCreateTime(createTimeFrom, createTimeTo); return customerDao.listValidCustomersByCreateTime(createTimeFrom, createTimeTo);
} }
@Override
public List<CustomerEntity> listValidCustomersByUpdatedTime(Date startTime, Date endTime) {
return customerDao.listValidCustomersByUpdateTime(startTime, endTime);
}
} }

129
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java

@ -1,8 +1,6 @@
package com.epmet.service.impl; package com.epmet.service.impl;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.RobotConstant; import com.epmet.constant.RobotConstant;
import com.epmet.constant.StatsSubject;
import com.epmet.entity.crm.CustomerEntity; import com.epmet.entity.crm.CustomerEntity;
import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.org.CustomerDepartmentEntity;
@ -18,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -54,6 +53,17 @@ public class StatsDimServiceImpl implements StatsDimService {
@Override @Override
public void initGridDim() { public void initGridDim() {
List<DimGridEntity> newDimGrids = getNewDimGrids();
List<DimGridEntity> changedGrids = getChangedGrids();
dimGridService.initGridDims(newDimGrids, changedGrids);
}
/**
* 初始化新建网格
* @return
*/
public List<DimGridEntity> getNewDimGrids() {
DimGridEntity lastDimEntity = dimGridService.getLastCreatedGridDim(); DimGridEntity lastDimEntity = dimGridService.getLastCreatedGridDim();
List<CustomerGridEntity> grids; List<CustomerGridEntity> grids;
Date now = new Date(); Date now = new Date();
@ -65,10 +75,36 @@ public class StatsDimServiceImpl implements StatsDimService {
grids = customerGridService.listGridsByCreateTime(lastInitTime, now); grids = customerGridService.listGridsByCreateTime(lastInitTime, now);
} }
List<DimGridEntity> gridDims = convertCustomerGrid2GridDim(grids, now); return convertCustomerGrid2GridDim(grids, now);
if (!CollectionUtils.isEmpty(gridDims)) { }
dimGridService.initGridDims(gridDims);
/**
* 初始化变更的网格
* @return
*/
public List<DimGridEntity> getChangedGrids() {
DimGridEntity lastUpdatedGridDim = dimGridService.getLastUpdatedGridDim();
List<CustomerGridEntity> updatedGrids;
Date now = new Date();
if (lastUpdatedGridDim != null) {
Date lastInitTime = lastUpdatedGridDim.getUpdatedTime();
updatedGrids = customerGridService.listUpdatedGridsByUpdateTime(lastInitTime, now);
ArrayList<DimGridEntity> dimGrids = new ArrayList<>();
for (CustomerGridEntity updatedGrid : updatedGrids) {
DimGridEntity dimGrid = dimGridService.selectById(updatedGrid.getId());
if (dimGrid != null) {
dimGrid.setGridName(updatedGrid.getGridName());
dimGrid.setUpdatedTime(now);
dimGrid.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
dimGrids.add(dimGrid);
}
}
return dimGrids;
} }
return new ArrayList<>();
} }
/** /**
@ -98,19 +134,41 @@ public class StatsDimServiceImpl implements StatsDimService {
*/ */
@Override @Override
public void initAgencyDim() { public void initAgencyDim() {
Date now = new Date();
List<CustomerAgencyEntity> agencies2Add = listAgencies2Add(now);
List<CustomerAgencyEntity> agencies2Update = listAgencies2Update(now);
dimAgencyService.initAgencyDims(agencies2Add, agencies2Update, now);
}
/**
* 查询需要添加的机关ç
* @return
*/
public List<CustomerAgencyEntity> listAgencies2Add(Date endDate) {
DimAgencyEntity latestCreatedAgencyDim = dimAgencyService.getLatestCreatedAgencyDimEntity(); DimAgencyEntity latestCreatedAgencyDim = dimAgencyService.getLatestCreatedAgencyDimEntity();
Date now = new Date();
Date lastInitTime = null; Date lastInitTime = null;
if (latestCreatedAgencyDim != null) { if (latestCreatedAgencyDim != null) {
lastInitTime = latestCreatedAgencyDim.getCreatedTime(); lastInitTime = latestCreatedAgencyDim.getCreatedTime();
} }
List<CustomerAgencyEntity> agencies = customerAgencyService.listAgenciesByCreateTime(lastInitTime, now); return customerAgencyService.listAgenciesByCreateTime(lastInitTime, endDate);
if (!CollectionUtils.isEmpty(agencies)) { }
dimAgencyService.initAgencyDims(agencies, now);
/**
* 查询需要更新的机关
* @return
*/
public List<CustomerAgencyEntity> listAgencies2Update(Date endDate) {
DimAgencyEntity latestUpdatedAgencyDim = dimAgencyService.getLatestUpdatedAgencyDimEntity();
if (latestUpdatedAgencyDim != null) {
// 不是首次初始化,可以更新
Date updatedTime = latestUpdatedAgencyDim.getUpdatedTime();
return customerAgencyService.listAgenciesByUpdatedTime(updatedTime, endDate);
} }
return new ArrayList<>();
} }
/** /**
@ -118,24 +176,59 @@ public class StatsDimServiceImpl implements StatsDimService {
*/ */
@Override @Override
public void initCustomerDim() { public void initCustomerDim() {
Date now = new Date();
List<CustomerEntity> newCustomers = listNewCustomers(now);
List<CustomerEntity> updatedCustomers = listUpdatedCustomers(now);
// System.out.println(666);
dimCustomerService.initCustomerDims(newCustomers, updatedCustomers, now);
}
/**
* 查询新增的客户列表
* @param initTime
* @return
*/
public List<CustomerEntity> listNewCustomers(Date initTime) {
DimCustomerEntity lastCreateDim = dimCustomerService.getLatestCreatedDimEntity(); DimCustomerEntity lastCreateDim = dimCustomerService.getLatestCreatedDimEntity();
Date now = new Date();
Date lastInitTime = null; Date lastInitTime = null;
if (lastCreateDim != null) { if (lastCreateDim != null) {
lastInitTime = lastCreateDim.getCreatedTime(); lastInitTime = lastCreateDim.getCreatedTime();
} }
List<CustomerEntity> customers = customerService.listValidCustomersByCreateTime(lastInitTime, now); List<CustomerEntity> customers = customerService.listValidCustomersByCreateTime(lastInitTime, initTime);
if (!CollectionUtils.isEmpty(customers)) {
dimCustomerService.initCustomerDims(customers, now); return customers;
}
/**
* 查询更新的客户列表
* @param initTime
* @return
*/
public List<CustomerEntity> listUpdatedCustomers(Date initTime) {
DimCustomerEntity lastCreatedDim = dimCustomerService.getLatestUpdatedDimEntity();
if (lastCreatedDim != null) {
// 说明不是首次初始化
List<CustomerEntity> customers = customerService.listValidCustomersByUpdatedTime(lastCreatedDim.getUpdatedTime(), initTime);
return customers;
} }
return new ArrayList<>();
} }
/**
* 初始化部门维度
*/
@Override @Override
public void initDepartmentDim() { public void initDepartmentDim() {
Date now = new Date();
List<CustomerDepartmentEntity> newDepartments = listNewDepartments(now);
List<CustomerDepartmentEntity> updatedDepartments = listUpdatedDepartments(now);
dimDepartmentService.initDepartmentDims(newDepartments, updatedDepartments, now);
}
public List<CustomerDepartmentEntity> listNewDepartments(Date initTime) {
DimDepartmentEntity lastCreatedDeptDim = dimDepartmentService.getLatestCreatedDimEntity(); DimDepartmentEntity lastCreatedDeptDim = dimDepartmentService.getLatestCreatedDimEntity();
Date now = new Date(); Date now = new Date();
@ -144,10 +237,14 @@ public class StatsDimServiceImpl implements StatsDimService {
if (lastCreatedDeptDim != null) { if (lastCreatedDeptDim != null) {
lastInitTime = lastCreatedDeptDim.getCreatedTime(); lastInitTime = lastCreatedDeptDim.getCreatedTime();
} }
return departmentService.listDepartmentsByCreatedTime(lastInitTime, now);
}
List<CustomerDepartmentEntity> departments = departmentService.listDepartmentsByCreatedTime(lastInitTime, now); public List<CustomerDepartmentEntity> listUpdatedDepartments(Date initTime) {
if (!CollectionUtils.isEmpty(departments)) { DimDepartmentEntity lastUpdatedDeptDim = dimDepartmentService.getLatestUpdatedDimEntity();
dimDepartmentService.initDepartmentDims(departments, now); if (lastUpdatedDeptDim != null) {
return departmentService.listDepartmentsByUpdatedTime(lastUpdatedDeptDim.getCreatedTime(), initTime);
} }
return new ArrayList<>();
} }
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java

@ -613,7 +613,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
for (ArticleTagsEntity tagEntity : articleTagsList) { for (ArticleTagsEntity tagEntity : articleTagsList) {
ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId()); ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId());
if (articleEntity == null) { if (articleEntity == null) {
log.error("publicitySummary articleMap articleId:{} ", tagEntity.getArticleId()); log.error("publicitySummary articleMap not contain articleId:{} ", tagEntity.getArticleId());
continue; continue;
} }
DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId()); DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId());

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -7,4 +7,6 @@ import java.util.List;
public interface CustomerAgencyService { public interface CustomerAgencyService {
List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime); List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime);
List<CustomerAgencyEntity> listAgenciesByUpdatedTime(Date updatedTime, Date now);
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java

@ -8,4 +8,6 @@ import java.util.List;
public interface CustomerDepartmentService { public interface CustomerDepartmentService {
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo); List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date createdTime, Date initTime);
} }

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

@ -32,4 +32,12 @@ public interface CustomerGridService {
* @author zxc * @author zxc
*/ */
List<GridIdListByCustomerResultDTO> getCustomerGridIdList(String customerId, String dateId); List<GridIdListByCustomerResultDTO> getCustomerGridIdList(String customerId, String dateId);
/**
* 根据更新时间查询变更过的网格列表
* @param lastInitTime
* @param now
* @return
*/
List<CustomerGridEntity> listUpdatedGridsByUpdateTime(Date lastInitTime, Date now);
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -22,4 +22,9 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
public List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) { public List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) {
return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime); return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime);
} }
@Override
public List<CustomerAgencyEntity> listAgenciesByUpdatedTime(Date startTime, Date endTime) {
return customerAgencyDao.listAgenciesByUpdatedTime(startTime, endTime);
}
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java

@ -28,4 +28,9 @@ public class CustomerDepartmentServiceImpl implements CustomerDepartmentService
public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) { public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) {
return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo); return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo);
} }
@Override
public List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date startTime, Date endTime) {
return departmentDao.listDepartmentsByUpdatedTime(startTime, endTime);
}
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -46,4 +46,9 @@ public class CustomerGridServiceImpl implements CustomerGridService {
public List<GridIdListByCustomerResultDTO> getCustomerGridIdList(String customerId, String dateId) { public List<GridIdListByCustomerResultDTO> getCustomerGridIdList(String customerId, String dateId) {
return customerGridDao.getCustomerGridIdList(customerId, dateId); return customerGridDao.getCustomerGridIdList(customerId, dateId);
} }
@Override
public List<CustomerGridEntity> listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) {
return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now);
}
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java

@ -107,9 +107,8 @@ public interface DimAgencyService extends BaseService<DimAgencyEntity> {
/** /**
* 初始化机关维度 * 初始化机关维度
* @param agencies
*/ */
void initAgencyDims(List<CustomerAgencyEntity> agencies, Date initTime); void initAgencyDims(List<CustomerAgencyEntity> agencies2Add, List<CustomerAgencyEntity> agencies2Update, Date initTime);
/** /**
* @Description 查询所有机关以及它下级机关的信息 * @Description 查询所有机关以及它下级机关的信息
@ -175,4 +174,6 @@ public interface DimAgencyService extends BaseService<DimAgencyEntity> {
String getPidByAgencyId(String agencyId); String getPidByAgencyId(String agencyId);
DimAgencyEntity getLatestCreatedAgencyDimEntity(); DimAgencyEntity getLatestCreatedAgencyDimEntity();
DimAgencyEntity getLatestUpdatedAgencyDimEntity();
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java

@ -110,9 +110,10 @@ public interface DimCustomerService extends BaseService<DimCustomerEntity> {
/** /**
* 添加客户维度 * 添加客户维度
* @param customers
*/ */
void initCustomerDims(List<CustomerEntity> customers, Date initTime); void initCustomerDims(List<CustomerEntity> newCustomers, List<CustomerEntity> updatedCustomers, Date initTime);
DimCustomerEntity getLatestCreatedDimEntity(); DimCustomerEntity getLatestCreatedDimEntity();
DimCustomerEntity getLatestUpdatedDimEntity();
} }

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java

@ -95,7 +95,7 @@ public interface DimDepartmentService extends BaseService<DimDepartmentEntity> {
*/ */
void delete(String[] ids); void delete(String[] ids);
void initDepartmentDims(List<CustomerDepartmentEntity> departments, Date initTime); void initDepartmentDims(List<CustomerDepartmentEntity> newDepartments, List<CustomerDepartmentEntity> updatedDepartments, Date initTime);
/** /**
* desc: 根据客户Id获取 部门数据 * desc: 根据客户Id获取 部门数据
@ -108,4 +108,6 @@ public interface DimDepartmentService extends BaseService<DimDepartmentEntity> {
List<DimDepartmentEntity> getDepartmentListByCustomerId(String customerId); List<DimDepartmentEntity> getDepartmentListByCustomerId(String customerId);
DimDepartmentEntity getLatestCreatedDimEntity(); DimDepartmentEntity getLatestCreatedDimEntity();
DimDepartmentEntity getLatestUpdatedDimEntity();
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java

@ -101,9 +101,8 @@ public interface DimGridService extends BaseService<DimGridEntity> {
/** /**
* 初始化网格维度 * 初始化网格维度
* @param gridDims
*/ */
void initGridDims(List<DimGridEntity> gridDims); void initGridDims(List<DimGridEntity> newDimGrids, List<DimGridEntity> changedGrids);
/** /**
* desc: 根据客户Id获取 该客户下所有的网格数据 * desc: 根据客户Id获取 该客户下所有的网格数据
@ -128,4 +127,6 @@ public interface DimGridService extends BaseService<DimGridEntity> {
* @author zxc * @author zxc
*/ */
List<SubAgencyIdResultDTO> selectSubAgencyId(List<AgencyDTO> formDTO); List<SubAgencyIdResultDTO> selectSubAgencyId(List<AgencyDTO> formDTO);
DimGridEntity getLastUpdatedGridDim();
} }

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java

@ -123,12 +123,25 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void initAgencyDims(List<CustomerAgencyEntity> agencies, Date initTime) { public void initAgencyDims(List<CustomerAgencyEntity> agencies2Add, List<CustomerAgencyEntity> agencies2Update, Date initTime) {
for (CustomerAgencyEntity agency : agencies) { // 添加新增的机关维度
for (CustomerAgencyEntity agency : agencies2Add) {
initAgencyAllDim(agency, initTime); initAgencyAllDim(agency, initTime);
initAgencySelfDim(agency, initTime); initAgencySelfDim(agency, initTime);
} }
// 更新变更过的机关维度
for (CustomerAgencyEntity agency : agencies2Update) {
DimAgencyEntity existsDimAgency = baseDao.selectById(agency.getId());
if (existsDimAgency != null) {
//说明是已存在的,不是新增的
existsDimAgency.setAgencyName(agency.getOrganizationName());
existsDimAgency.setUpdatedTime(initTime);
existsDimAgency.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
baseDao.updateById(existsDimAgency);
}
}
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY); lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY);
} }
@ -255,4 +268,9 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
return baseDao.getLatestCreatedAgencyDimEntity(); return baseDao.getLatestCreatedAgencyDimEntity();
} }
@Override
public DimAgencyEntity getLatestUpdatedAgencyDimEntity() {
return baseDao.getLatestUpdatedAgencyDimEntity();
}
} }

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java

@ -120,8 +120,9 @@ public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimC
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void initCustomerDims(List<CustomerEntity> customers, Date initTime) { public void initCustomerDims(List<CustomerEntity> newCustomers, List<CustomerEntity> updatedCustomers, Date initTime) {
for (CustomerEntity customer : customers) { // 添加新增的客户维度
for (CustomerEntity customer : newCustomers) {
DimCustomerEntity dim = new DimCustomerEntity(); DimCustomerEntity dim = new DimCustomerEntity();
dim.setCustomerName(customer.getCustomerName()); dim.setCustomerName(customer.getCustomerName());
dim.setCreatedBy(RobotConstant.DIMENSION_ROBOT); dim.setCreatedBy(RobotConstant.DIMENSION_ROBOT);
@ -131,6 +132,18 @@ public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimC
dim.setUpdatedTime(initTime); dim.setUpdatedTime(initTime);
baseDao.insert(dim); baseDao.insert(dim);
} }
// 更新已存在的客户维度
for (CustomerEntity updatedCustomer : updatedCustomers) {
DimCustomerEntity existsCustomerDim = baseDao.selectById(updatedCustomer.getId());
if (existsCustomerDim != null) {
existsCustomerDim.setCustomerName(updatedCustomer.getCustomerName());
existsCustomerDim.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
existsCustomerDim.setUpdatedTime(initTime);
baseDao.updateById(existsCustomerDim);
}
}
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_CUSTOMER); lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_CUSTOMER);
} }
@ -138,4 +151,9 @@ public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimC
public DimCustomerEntity getLatestCreatedDimEntity() { public DimCustomerEntity getLatestCreatedDimEntity() {
return baseDao.getLatestCreatedDimEntity(); return baseDao.getLatestCreatedDimEntity();
} }
@Override
public DimCustomerEntity getLatestUpdatedDimEntity() {
return baseDao.getLatestUpdatedDimEntity();
}
} }

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java

@ -109,8 +109,9 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void initDepartmentDims(List<CustomerDepartmentEntity> departments, Date initTime) { public void initDepartmentDims(List<CustomerDepartmentEntity> newDepartments, List<CustomerDepartmentEntity> updatedDepartments, Date initTime) {
for (CustomerDepartmentEntity department : departments) { // 新增科室初始化
for (CustomerDepartmentEntity department : newDepartments) {
DimDepartmentEntity dim = new DimDepartmentEntity(); DimDepartmentEntity dim = new DimDepartmentEntity();
dim.setAgencyId(department.getAgencyId()); dim.setAgencyId(department.getAgencyId());
dim.setCustomerId(department.getCustomerId()); dim.setCustomerId(department.getCustomerId());
@ -122,6 +123,18 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
dim.setUpdatedTime(initTime); dim.setUpdatedTime(initTime);
baseDao.insert(dim); baseDao.insert(dim);
} }
// 修改科室初始化
for (CustomerDepartmentEntity updatedDepartment : updatedDepartments) {
DimDepartmentEntity dimDepartment = baseDao.selectById(updatedDepartment.getId());
if (dimDepartment != null) {
dimDepartment.setDepartmentName(updatedDepartment.getDepartmentName());
dimDepartment.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
dimDepartment.setUpdatedTime(initTime);
baseDao.updateById(dimDepartment);
}
}
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_DEPARTMENT); lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_DEPARTMENT);
} }
@ -137,4 +150,9 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
public DimDepartmentEntity getLatestCreatedDimEntity() { public DimDepartmentEntity getLatestCreatedDimEntity() {
return baseDao.getLatestCreatedDimEntity(); return baseDao.getLatestCreatedDimEntity();
} }
@Override
public DimDepartmentEntity getLatestUpdatedDimEntity() {
return baseDao.getLatestUpdatedDimEntity();
}
} }

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java

@ -117,13 +117,16 @@ public class DimGridServiceImpl extends BaseServiceImpl<DimGridDao, DimGridEntit
/** /**
* 初始化网格维度 * 初始化网格维度
* @param gridDims
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void initGridDims(List<DimGridEntity> gridDims) { public void initGridDims(List<DimGridEntity> newDimGrids, List<DimGridEntity> changedGrids) {
for (DimGridEntity gridDim : gridDims) { for (DimGridEntity newGridDim : newDimGrids) {
baseDao.insert(gridDim); baseDao.insert(newGridDim);
}
for (DimGridEntity updatedGridDim : changedGrids) {
baseDao.updateById(updatedGridDim);
} }
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_GRID); lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_GRID);
@ -156,4 +159,9 @@ public class DimGridServiceImpl extends BaseServiceImpl<DimGridDao, DimGridEntit
public List<SubAgencyIdResultDTO> selectSubAgencyId(List<AgencyDTO> formDTO) { public List<SubAgencyIdResultDTO> selectSubAgencyId(List<AgencyDTO> formDTO) {
return baseDao.selectSubAgencyId(formDTO); return baseDao.selectSubAgencyId(formDTO);
} }
@Override
public DimGridEntity getLastUpdatedGridDim() {
return baseDao.getLastUpdatedGridDim();
}
} }

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml

@ -41,4 +41,27 @@
CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC
</select> </select>
<select id="listValidCustomersByUpdateTime" resultType="com.epmet.entity.crm.CustomerEntity">
select id,
customer_name,
title,
organization_number,
organization_img,
validity_time,
customer_admin,
customer_password,
organization_levels,
logo,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
organization_level
from customer
where UPDATED_TIME >= #{startTime}
and UPDATED_TIME <![CDATA[<]]> #{endTime}
</select>
</mapper> </mapper>

20
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml

@ -16,4 +16,24 @@
</if> </if>
</where> </where>
</select> </select>
<select id="listDepartmentsByUpdatedTime" resultType="com.epmet.entity.org.CustomerDepartmentEntity">
select
id,
customer_id,
agency_id,
department_name,
department_duty,
total_user,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_department
where UPDATED_TIME > #{startTime}
and UPDATED_TIME <![CDATA[<=]]> #{endTime}
</select>
</mapper> </mapper>

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -47,4 +47,25 @@
AND customer_id = #{customerId} AND customer_id = #{customerId}
AND DATE_FORMAT( created_time, '%Y%m%d' ) <![CDATA[ <= ]]> #{dateId} AND DATE_FORMAT( created_time, '%Y%m%d' ) <![CDATA[ <= ]]> #{dateId}
</select> </select>
<select id="listUpdatedGridsByUpdateTime" resultType="com.epmet.entity.org.CustomerGridEntity">
SELECT id,
customer_id,
grid_name,
longitude,
latitude,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
manage_district,
total_user,
pid,
pids
FROM customer_grid
WHERE UPDATED_TIME >= #{startTime}
AND UPDATED_TIME <![CDATA[<]]> #{endTime}
</select>
</mapper> </mapper>

25
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -75,4 +75,29 @@
grid.ID grid.ID
</select> </select>
<select id="listAgenciesByUpdatedTime" resultType="com.epmet.entity.org.CustomerAgencyEntity">
select
id,
customer_id,
pid,
pids,
all_parent_name,
organization_name,
level,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
total_user,
province,
city,
district
from customer_agency
where UPDATED_TIME >= #{startTime}
and UPDATED_TIME <![CDATA[<=]]> #{endTime}
</select>
</mapper> </mapper>

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml

@ -277,4 +277,25 @@
LIMIT 1 LIMIT 1
</select> </select>
<!-- 最后一次更新的时间-->
<select id="getLatestUpdatedAgencyDimEntity" resultType="com.epmet.entity.stats.DimAgencyEntity">
select id,
agency_name,
customer_id,
pid,
pids,
all_parent_name,
level,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
agency_dim_type
from dim_agency
order by UPDATED_TIME desc
limit 1
</select>
</mapper> </mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml

@ -25,4 +25,19 @@
ORDER BY CREATED_TIME DESC ORDER BY CREATED_TIME DESC
LIMIT 1 LIMIT 1
</select> </select>
<select id="getLatestUpdatedDimEntity" resultType="com.epmet.entity.stats.DimCustomerEntity">
select
id,
customer_name,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from dim_customer
order by UPDATED_TIME desc
limit 1;
</select>
</mapper> </mapper>

17
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml

@ -35,4 +35,21 @@
ORDER BY CREATED_TIME DESC ORDER BY CREATED_TIME DESC
LIMIT 1 LIMIT 1
</select> </select>
<select id="getLatestUpdatedDimEntity" resultType="com.epmet.entity.stats.DimDepartmentEntity">
select
id,
department_name,
agency_id,
customer_id,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from dim_department
order by UPDATED_TIME desc
limit 1
</select>
</mapper> </mapper>

17
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml

@ -52,4 +52,21 @@
</foreach> </foreach>
</select> </select>
<select id="getLastUpdatedGridDim" resultType="com.epmet.entity.stats.DimGridEntity">
select id,
grid_name,
customer_id,
agency_id,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from dim_grid
order by UPDATED_TIME desc
limit 1;
</select>
</mapper> </mapper>

4
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java

@ -77,8 +77,8 @@ public class EventFormDTO implements Serializable {
/** /**
* 事件功能分组ID 来自oper_customize.customer_function表 * 事件功能分组ID 来自oper_customize.customer_function表
*/ */
@NotBlank(message = "事件功能分组ID不能为空",groups = {AddGroup.class}) @NotBlank(message = "功能分组ID不能为空",groups = {AddGroup.class})
private String eventGroupId; private String functionId;
/** /**
* 是否是通用事件 0-1-消息体内需要体现该字段通用则说明由业务系统自己计算分值 * 是否是通用事件 0-1-消息体内需要体现该字段通用则说明由业务系统自己计算分值

56
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java → epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java

@ -15,21 +15,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.epmet.dto; package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* 积分规则 * 事件
* *
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20 * @since v1.0.0 2020-07-16
*/ */
@Data @Data
public class PointRuleDTO implements Serializable { public class EventDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -39,59 +40,44 @@ public class PointRuleDTO implements Serializable {
private String id; private String id;
/** /**
* 客户ID * 消息网关事件类别ID 从消息网关获取事件类型Id
*/ */
private String customerId; private String classId;
/** /**
* 规则名称 与事件名称保持一致即可 * 消息网关APP_ID
*/ */
private String ruleName; private String appId;
/** /**
* 规则说明 事件说明 * 消息网关APP_NAME
*/ */
private String ruleDesc; private String appName;
/** /**
* 事件CODE 来自事件表 * 事件标识 与消息网关事件tag一致
*/ */
private String eventCode; private String eventCode;
/** /**
* 事件名称 来自事件表 * 事件名称
*/ */
private String eventName; private String eventName;
/** /**
* 操作类型 加积分:add;减积分:subtract * 事件说明
*/
private String operateType;
/**
* 积分上限
*/
private Integer upLimit;
/**
* 积分上限描述
*/
private String upLimitDesc;
/**
* 获得积分值
*/ */
private Integer pointNum; private String eventDesc;
/** /**
* 获得积分单位 time分钟minute小时hour * 事件功能分组ID 来自oper_customize.customer_function表
*/ */
private String pointUnit; private String functionId;
/** /**
* 是否启用 0-1- * 是否是通用事件 0-1-消息体内需要体现该字段通用则说明由业务系统自己计算分值
*/ */
private String enabledFlag; private String isCommon;
/** /**
* 删除标识 0-1- * 删除标识 0-1-
@ -99,7 +85,7 @@ public class PointRuleDTO implements Serializable {
private String delFlag; private String delFlag;
/** /**
* 乐观锁 * 乐观锁 查询时添加版本号新加的事件需要更新版本号
*/ */
private Integer revision; private Integer revision;

10
epmet-module/epmet-common-service/common-service-server/pom.xml

@ -116,6 +116,11 @@
<nacos.ip/> <nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled> <spring.flyway.enabled>false</spring.flyway.enabled>
<!--亿联云消息网关配置-->
<elink.mq.host>https://epmet-dev.elinkservice.cn/estos/</elink.mq.host>
<elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath>
<elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId>
<elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -177,6 +182,11 @@
<nacos.ip/> <nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled> <spring.flyway.enabled>true</spring.flyway.enabled>
<!--亿联云消息网关配置-->
<elink.mq.host>https://epmet-dev.elinkservice.cn/estos/</elink.mq.host>
<elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath>
<elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId>
<elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>

30
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java

@ -17,15 +17,22 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.config.MqConfig;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.form.EventFormDTO; import com.epmet.dto.form.EventFormDTO;
import com.epmet.dto.result.EventDTO;
import com.epmet.service.EventService; import com.epmet.service.EventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map;
/** /**
* 事件表 * 事件表
@ -33,12 +40,25 @@ import org.springframework.web.bind.annotation.*;
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-16 * @since v1.0.0 2020-07-16
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("event") @RequestMapping("event")
public class EventController { public class EventController {
@Autowired @Autowired
private EventService eventService; private EventService eventService;
@Autowired
private MqConfig mqConfig;
@GetMapping("page")
public Result<PageData<EventDTO>> page(@RequestParam Map<String, Object> params){
PageData<EventDTO> page = eventService.page(params);
return new Result<PageData<EventDTO>>().ok(page);
}
@GetMapping("geteventclass")
public Result<?> getEventClass(){
return SendMqMsgUtils.getEventClassList();
}
/** /**
* desc:添加事件如果已存在则不作任何改动直接返回成功 * desc:添加事件如果已存在则不作任何改动直接返回成功
@ -49,11 +69,11 @@ public class EventController {
* "classId":"epmet_heart", * "classId":"epmet_heart",
* "appId":"202007161443499985fa2d397436d10356542134c8f008c48", * "appId":"202007161443499985fa2d397436d10356542134c8f008c48",
* "appName":"党群e事通开发测试", * "appName":"党群e事通开发测试",
* "eventCode":"epmet_heart_active_send_point", * "eventCode":"register_volunteer",
* "eventName":"活动发放积分", * "eventName":"认证志愿者",
* "eventDesc":"给参加活动的人发放积分", * "eventDesc":"给注册志愿者的人发放积分",
* "eventGroupId":"1234", * "functionId":"43addd0735230c01eedbb38d721076b0",
* "isCommon":"1" * "isCommon":"0"
* } * }
*/ */
@PostMapping("addEvent") @PostMapping("addEvent")

5
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java

@ -18,13 +18,10 @@
package com.epmet.entity; package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* 事件表 * 事件表
* *
@ -71,7 +68,7 @@ public class EventEntity extends BaseEpmetEntity {
/** /**
* 事件功能分组ID 来自oper_customize.customer_function表 * 事件功能分组ID 来自oper_customize.customer_function表
*/ */
private String eventGroupId; private String functionId;
/** /**
* 是否是通用事件 0-1-消息体内需要体现该字段通用则说明由业务系统自己计算分值 * 是否是通用事件 0-1-消息体内需要体现该字段通用则说明由业务系统自己计算分值

6
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java

@ -11,17 +11,17 @@ public enum SysResponseEnum {
* *
* 编码样式CCCBBOOXX * 编码样式CCCBBOOXX
* 编码示例说明 * 编码示例说明
* CCC 中心编码&业务系统 (120-内容扫描服务中心服务) * CCC 中心编码&业务系统 (103-内容扫描服务中心服务)
* BB 业务类型00-默认 * BB 业务类型00-默认
* OO 操作类型00-默认 * OO 操作类型00-默认
* *
*/ */
/*通用枚举 */ /*通用枚举 */
EXCEPTION(12001,"系统异常"), EXCEPTION(10301,"系统异常"),
/*事件 业务 01*/ /*事件 业务 01*/
EVENT_HAS_ALREADY_EXIST(120010001,"事件已存在无需重复添加"), EVENT_HAS_ALREADY_EXIST(103010001,"事件已存在无需重复添加"),
; ;
private Integer code; private Integer code;

6
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java

@ -18,9 +18,13 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.EventFormDTO; import com.epmet.dto.form.EventFormDTO;
import com.epmet.dto.result.EventDTO;
import com.epmet.entity.EventEntity; import com.epmet.entity.EventEntity;
import java.util.Map;
/** /**
* 事件表 * 事件表
* *
@ -32,4 +36,6 @@ public interface EventService extends BaseService<EventEntity> {
void addEvent(EventFormDTO formDTO); void addEvent(EventFormDTO formDTO);
void updateEvent(EventFormDTO formDTO); void updateEvent(EventFormDTO formDTO);
PageData<EventDTO> page(Map<String, Object> params);
} }

36
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java

@ -17,18 +17,23 @@
package com.epmet.service.impl; 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.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.constant.FieldConstant;
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.utils.ConvertUtils;
import com.epmet.dao.EventDao; import com.epmet.dao.EventDao;
import com.epmet.dto.form.EventFormDTO; import com.epmet.dto.form.EventFormDTO;
import com.epmet.dto.result.EventDTO;
import com.epmet.entity.EventEntity; import com.epmet.entity.EventEntity;
import com.epmet.enu.SysResponseEnum;
import com.epmet.service.EventService; import com.epmet.service.EventService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map;
/** /**
* 事件表 * 事件表
* *
@ -38,18 +43,17 @@ import org.springframework.stereotype.Service;
@Slf4j @Slf4j
@Service @Service
public class EventServiceImpl extends BaseServiceImpl<EventDao, EventEntity> implements EventService { public class EventServiceImpl extends BaseServiceImpl<EventDao, EventEntity> implements EventService {
@Override
public PageData<EventDTO> page(Map<String, Object> params) {
IPage<EventEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, EventDTO.class);
}
@Override @Override
public void addEvent(EventFormDTO formDTO) { public void addEvent(EventFormDTO formDTO) {
if (baseDao.getCountByEventCode(formDTO.getEventCode()) > 0) {
log.warn("addEvent fail,msg:{}", SysResponseEnum.EVENT_HAS_ALREADY_EXIST.getMsg());
return;
}
EventEntity eventEntity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class); EventEntity eventEntity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class);
if (eventEntity == null) {
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
baseDao.insert(eventEntity); baseDao.insert(eventEntity);
} }
@ -57,4 +61,12 @@ public class EventServiceImpl extends BaseServiceImpl<EventDao, EventEntity> imp
public void updateEvent(EventFormDTO formDTO) { public void updateEvent(EventFormDTO formDTO) {
//baseDao.update(eventEntity); //baseDao.update(eventEntity);
} }
private QueryWrapper<EventEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<EventEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
} }

10
epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml

@ -117,4 +117,12 @@ ribbon:
#pageHelper分页插件 #pageHelper分页插件
pagehelper: pagehelper:
helper-dialect: mysql helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
#亿联云消息网关
elink:
mq:
appId: @elink.mq.appId@ #项目接入亿联云的应用Id
token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
host: @elink.mq.host@ #亿联云消息网关服务地址
sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径

37
epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql

@ -418,21 +418,22 @@ INSERT INTO `calender` VALUES ('ffe45e7059c67874f88498cfcfd19b4c', 0, '20200424'
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
#add by liujianjun 2020-07-16 #add by liujianjun 2020-07-16
CREATE TABLE event( CREATE TABLE `event` (
ID VARCHAR(64) NOT NULL COMMENT '主键' , `ID` varchar(64) NOT NULL COMMENT '主键',
CLASS_ID VARCHAR(32) COMMENT '消息网关事件类别ID 从消息网关获取事件类型Id' , `CLASS_ID` varchar(32) DEFAULT NULL COMMENT '消息网关事件类别ID 从消息网关获取事件类型Id',
APP_ID VARCHAR(128) COMMENT '消息网关APP_ID' , `APP_ID` varchar(128) DEFAULT NULL COMMENT '消息网关APP_ID',
APP_NAME VARCHAR(32) COMMENT '消息网关APP_NAME' , `APP_NAME` varchar(32) DEFAULT NULL COMMENT '消息网关APP_NAME',
EVENT_CODE VARCHAR(32) COMMENT '事件标识 与消息网关事件tag一致' , `EVENT_CODE` varchar(32) DEFAULT NULL COMMENT '事件标识 与消息网关事件tag一致',
EVENT_NAME VARCHAR(32) COMMENT '事件名称' , `EVENT_NAME` varchar(32) DEFAULT NULL COMMENT '事件名称',
EVENT_DESC VARCHAR(64) COMMENT '事件说明' , `EVENT_DESC` varchar(64) DEFAULT NULL COMMENT '事件说明',
EVENT_GROUP_ID VARCHAR(512) COMMENT '事件功能分组ID 来自oper_customize.customer_function表' , `FUNCTION_ID` varchar(64) DEFAULT NULL COMMENT '功能ID 来自oper_customize.customer_function表',
IS_COMMON VARCHAR(1) COMMENT '是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值' , `IS_COMMON` varchar(1) DEFAULT NULL COMMENT '是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值',
DEL_FLAG VARCHAR(1) COMMENT '删除标识 0-否,1-是' , `DEL_FLAG` varchar(1) DEFAULT NULL COMMENT '删除标识 0-否,1-是',
REVISION INT COMMENT '乐观锁 查询时添加版本号,新加的事件需要更新版本号' , `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁 查询时添加版本号,新加的事件需要更新版本号',
CREATED_BY VARCHAR(32) COMMENT '创建人' , `CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人',
CREATED_TIME DATETIME COMMENT '创建时间' , `CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间',
UPDATED_BY VARCHAR(32) COMMENT '更新人' , `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人',
UPDATED_TIME DATETIME COMMENT '更新时间' , `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (ID) PRIMARY KEY (`ID`),
) COMMENT = '事件表'; UNIQUE KEY `unx_event_code` (`EVENT_CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件表';

2
epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml

@ -11,7 +11,7 @@
<result property="eventCode" column="EVENT_CODE"/> <result property="eventCode" column="EVENT_CODE"/>
<result property="eventName" column="EVENT_NAME"/> <result property="eventName" column="EVENT_NAME"/>
<result property="eventDesc" column="EVENT_DESC"/> <result property="eventDesc" column="EVENT_DESC"/>
<result property="eventGroupId" column="EVENT_GROUP_ID"/> <result property="functionId" column="FUNCTION_ID"/>
<result property="isCommon" column="IS_COMMON"/> <result property="isCommon" column="IS_COMMON"/>
<result property="delFlag" column="DEL_FLAG"/> <result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/> <result property="revision" column="REVISION"/>

6
epmet-module/epmet-heart/epmet-heart-client/pom.xml

@ -26,6 +26,12 @@
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

11
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java

@ -112,7 +112,7 @@ public class ActInfoDTO implements Serializable {
/** /**
* 活动签到打卡位置经度 * 活动签到打卡位置经度
*/ */
private BigDecimal signinLongitude; private BigDecimal signInLongitude;
/** /**
* 活动签到打卡位置纬度 * 活动签到打卡位置纬度
@ -247,4 +247,11 @@ public class ActInfoDTO implements Serializable {
*/ */
private String delFlag; private String delFlag;
} // 虚字段
/**
* 用户id
*/
private String userId;
}

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java

@ -53,9 +53,14 @@ public class ActOperationRecDTO implements Serializable {
private String type; private String type;
/** /**
* 1通知用户0不通知 * 1通知用户0不通知取消活动时默认true
*/ */
private Boolean noticeUser; private Boolean noticeUser;
/**
* 备注取消活动时此列有值
*/
private String remark;
/** /**
* 删除标记 * 删除标记

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto; package com.epmet.dto;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
@ -48,11 +49,6 @@ public class ActPointLogDTO implements Serializable {
*/ */
private String userId; private String userId;
/**
* 加积分add ; 减积分subtract
*/
private String pointType;
/** /**
* 积分值 * 积分值
*/ */
@ -98,5 +94,4 @@ public class ActPointLogDTO implements Serializable {
* 更新时间 * 更新时间
*/ */
private Date updatedTime; private Date updatedTime;
} }

15
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto; package com.epmet.dto;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
@ -44,7 +45,7 @@ public class ActStatisticalDTO implements Serializable {
private String actId; private String actId;
/** /**
* 报名总人数已报名/待审核auditing审核通过passed审核不通过refused取消报名canceld总人数 * 报名总人数已报名/待审核auditing审核通过passed审核不通过refused取消报名canceld总人数
*/ */
private Integer signupNum; private Integer signupNum;
@ -73,16 +74,6 @@ public class ActStatisticalDTO implements Serializable {
*/ */
private Integer signedInUserNum; private Integer signedInUserNum;
/**
* 添加实况总人数
*/
private Integer liveUserNum;
/**
* 实况总记录数
*/
private Integer liveCount;
/** /**
* 发放积分总人数 * 发放积分总人数
*/ */

14
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto; package com.epmet.dto;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
@ -50,13 +51,10 @@ public class ActUserLogDTO implements Serializable {
/** /**
* 操作类型已报名/待审核auditing * 操作类型已报名/待审核auditing
审核通过passed * 审核通过passed
审核不通过refused * 审核不通过refused
取消报名canceld * 取消报名canceled
发放积分rewarded *
拒绝发放积分refuse_reward
重新处理processing
*/ */
private String operationType; private String operationType;

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserRelationDTO.java

@ -17,9 +17,10 @@
package com.epmet.dto; package com.epmet.dto;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
@ -52,7 +53,7 @@ public class ActUserRelationDTO implements Serializable {
* 当前状态已报名/待审核auditing * 当前状态已报名/待审核auditing
审核通过passed 审核通过passed
审核不通过refused 审核不通过refused
取消报名canceld 取消报名canceled
*/ */
private String status; private String status;

81
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java

@ -1,81 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
/**
* 用户活动打卡参数
*
* @author zhangyong
* @since v1.0.0 2020-07-14
*/
@Data
public class ActUserClockLogFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private String userId;
/**
* 活动ID
*/
@NotBlank(message = "活动ID不能为空")
private String actId;
/**
* 打卡类型0-打卡1-更新打卡
*/
@NotBlank(message = "打卡类型不能为空")
private String clockType;
/**
* 打卡位置经度
*/
@NotBlank(message = "打卡位置经度不能为空")
private BigDecimal clockLongitude;
/**
* 打卡位置纬度
*/
@NotBlank(message = "打卡位置纬度不能为空")
private BigDecimal clockLatitude;
/**
* 打卡地址
*/
@NotBlank(message = "打卡地址不能为空")
private String clockAddress;
/**
* 打卡描述
*/
@NotBlank(message = "打卡描述不能为空")
private String clockDesc;
/**
* 打卡是否有效0-1-
*/
@NotBlank(message = "打卡是否有效不能为空")
private String effectiveFlag;
/**
* 打卡图片
*/
private ArrayList<String> images;
}

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java

@ -28,18 +28,18 @@ public class ResiActCaculateDistanceFormDTO implements Serializable {
/** /**
* 经度 * 经度
*/ */
@NotBlank(message = "经度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) @NotBlank(message = "经度不能为空", groups = { AddUserInternalGroup.class })
private Double longitude; private Double longitude;
/** /**
* 纬度 * 纬度
*/ */
@NotBlank(message = "纬度不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) @NotBlank(message = "纬度不能为空", groups = { AddUserInternalGroup.class })
private Double latitude; private Double latitude;
/** /**
* 用户id * 用户id
*/ */
@NotBlank(message = "活动ID不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class })
private String actId; private String actId;
} }

46
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java

@ -0,0 +1,46 @@
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动内容(活动详情-已结束-回顾稿) 入参
*
* @Auther: zhangyong
* @Date: 2020-07-21 18:12
*/
@Data
public class ResiActContentFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**
* 页码从1开始
*/
@Min(value = 1, message = "页码必须大于0", groups = { AddUserInternalGroup.class })
private Integer pageNo;
/**
* 页容量默认20页
*/
@Min(value = 1, message = "每页条数必须大于必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class })
private Integer pageSize;
}

38
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动详情 入参
*
* @Auther: zhangyong
* @Date: 2020-07-21 18:12
*/
@Data
public class ResiActDetailFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动Id
*/
@NotBlank(message = "活动Id不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**
* 用户id
*/
private String userId;
}

104
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 活动-添加实况 入参
*
* @author zhangyong
* @since v1.0.0 2020-07-23
*/
@Data
public class ResiActInsertLiveFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 活动ID
*/
@NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**
* 活动签到描述
*/
private String desc;
/**
* 活动签到位置经度
*/
@NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal longitude;
/**
* 活动签到位置纬度
*/
@NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal latitude;
/**
* 活动签到地址
*/
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
private String address;
/**
* 图片
*/
private List<String> images;
/**
* 用户id
*/
private String userId;
/**
* id
*/
private String id;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class })
private String customerId;
}

61
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java

@ -0,0 +1,61 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 活动报名参数
*
* @author zhangyong
* @since v1.0.0 2020-07-20
*/
@Data
public class ResiActRegistrationFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
//>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>>
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
public interface AddUserInternalGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
* 用户Id
*/
private String userId;
/**
* 活动ID
*/
@NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class })
private String actId;
/**
* 客户ID
*/
@NotBlank(message = "客户ID不能为空", groups = { AddUserInternalGroup.class })
private String customerId;
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save