Browse Source

Merge branches 'dev' and 'release' of http://git.elinkit.com.cn:7070/r/epmet-cloud into release

dev
sunyuchao 5 years ago
parent
commit
040ddf7aaf
  1. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java
  2. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  3. 34
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  4. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/HeartUserInfoDTO.java
  5. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java
  6. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java
  7. 2
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java
  8. 2
      epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml
  9. 2
      epmet-module/epmet-heart/epmet-heart-server/pom.xml
  10. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ActCustomizedController.java
  11. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  12. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
  13. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/HeartUserInfoEntity.java
  14. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java
  15. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  16. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
  17. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql
  18. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  19. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml
  20. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml
  21. 2
      epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml
  22. 2
      epmet-module/epmet-message/epmet-message-server/pom.xml
  23. 3
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/UserMessageServiceImpl.java
  24. 6
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml
  25. 2
      epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml
  26. 2
      epmet-module/epmet-point/epmet-point-server/pom.xml
  27. 15
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java
  28. 6
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java
  29. 6
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java
  30. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java
  31. 4
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/redis/PointRedis.java
  32. 19
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java
  33. 51
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  34. 26
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java
  35. 5
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml
  36. 4
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml
  37. 86
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FixationAppIdDTO.java
  38. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ModifyCustomerFormDTO.java
  39. 30
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/FixationAppIdResultDTO.java
  40. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml
  41. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  42. 15
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java
  43. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java
  44. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java
  45. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java
  46. 43
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/FixationAppIdDao.java
  47. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java
  48. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java
  49. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java
  50. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java
  51. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FixationAppIdEntity.java
  52. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  53. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java
  54. 37
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  55. 146
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java
  56. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java
  57. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java
  58. 13
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.4__thirdUpdate.sql
  59. 8
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml
  60. 17
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FixationAppIdDao.xml
  61. 8
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml
  62. 8
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml
  63. 8
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml
  64. 16
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml
  65. 2
      epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml
  66. 2
      epmet-module/gov-access/gov-access-server/pom.xml
  67. 12
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
  68. 6
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
  69. 2
      epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml
  70. 2
      epmet-module/oper-crm/oper-crm-server/pom.xml
  71. 13
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  72. 2
      epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml
  73. 8
      epmet-module/resi-mine/resi-mine-server/pom.xml
  74. 22
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java
  75. 10
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java
  76. 47
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java
  77. 38
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/LatestGridInfoFormDTO.java
  78. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  79. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  80. 2
      epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
  81. 2
      epmet-user/epmet-user-server/pom.xml
  82. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java
  83. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java
  84. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java
  85. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java
  86. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java
  87. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java
  88. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java
  89. 15
      epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java

@ -117,8 +117,27 @@ public enum RequirePermissionEnum {
WORK_GRASSROOTS_PARTY_BRANCH_DELETE("work_grassroots_party_branch_delete","基层治理:支部管理:删除党支部","支部管理-删除党支部"),
WORK_GRASSROOTS_PARTY_MEMBER_ADD("work_grassroots_party_member_add","基层治理:支部管理:添加党员","支部管理-添加党员"),
WORK_GRASSROOTS_PARTY_MEMBER_EDIT("work_grassroots_party_member_edit","基层治理:支部管理:编辑党员","支部管理-编辑党员"),
WORK_GRASSROOTS_PARTY_MEMBER_DELETE("work_grassroots_party_member_delete","基层治理:支部管理:删除党员","支部管理-删除党员");
WORK_GRASSROOTS_PARTY_MEMBER_DELETE("work_grassroots_party_member_delete","基层治理:支部管理:删除党员","支部管理-删除党员"),
/**
* 积分-积分规则
*/
MORE_POINT_RULE_LIST("more_point_rule_list","更多:积分:积分规则:查看规则列表","更多-积分-积分规则-查看规则列表"),
MORE_POINT_RULE_DETAIL("more_point_rule_detail","更多:积分:积分规则:查看规则详情","更多-积分-积分规则-查看规则详情"),
MORE_POINT_RULE_SAVE("more_point_rule_save","更多:积分:积分规则:确认修改规则","更多-积分-积分规则-确认修改积分规则"),
MORE_POINT_RULE_FUNCTION_LIST("more_point_rule_function_list","更多:积分:积分规则:功能列表","更多-积分-积分规则-功能列表"),
/**
* 积分-人员管理
*/
MORE_POINT_USER_MANAGE_LIST("more_point_user_manage_list","更多:积分:人员管理:查看人员列表","更多-积分-人员管理-查看人员列表"),
MORE_POINT_USER_MANAGE_DETAIL_VIEW("more_point_user_manage_detail_view","更多:积分:人员管理:查看人员详情","更多-积分-人员管理-人员详情"),
MORE_POINT_USER_MANAGE_ADJUST_POINT("more_point_user_manage_adjust_point","更多:积分:人员管理:确认调整积分","更多-积分-人员管理-确认调整积分"),
MORE_POINT_USER_MANAGE_ADJUST_REC_VIEW("more_point_user_manage_adjust_rec_view","更多:积分:人员管理:查看调整记录","更多-积分-人员管理-查看调整记录"),
/**
* 爱心互助-自定义配置
*/
MORE_HEART_CUSTOMIZED_VIEW("more_heart_customized_view","更多:爱心互助:自定义配置:查看","更多-爱心互助-自定义配置-查看"),
MORE_HEART_CUSTOMIZED_SAVE("more_heart_customized_save","更多:爱心互助:自定义配置:保存修改","更多-爱心互助-自定义配置-保存修改");
private String key;
private String name;

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java

@ -54,12 +54,12 @@ public class RenExceptionHandler {
*/
@ExceptionHandler(RenException.class)
public Result handleRRException(RenException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
if (ex.getCode() > 8000) {
Result result=new Result().error(ex.getCode());
result.setData(ex.getMsg());
return result;
}
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result().error();
result.setData(ex.getMsg());
return result;

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

@ -6,6 +6,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
@ -326,6 +327,23 @@ public class HttpClientManager {
}
}
public Result<byte[]> getMediaByteArray(String url, String json) {
try {
HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig);
httppost.addHeader("Content-Type", "application/json");
if (StringUtils.isNotEmpty(json)) {
StringEntity se = new StringEntity(json, "utf-8");
httppost.setEntity(se);
}
return executeToByte(httppost);
} 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) {
CloseableHttpResponse response = null;
try {
@ -334,14 +352,16 @@ public class HttpClientManager {
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);
}
byte[] responseContent = IOUtils.toByteArray(in);
// 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());
// return new Result<byte[]>().ok(output.toByteArray());
return new Result<byte[]>().ok(responseContent);
} else {
log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
}

4
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/HeartUserInfoDTO.java

@ -61,7 +61,7 @@ public class HeartUserInfoDTO implements Serializable {
private Integer kindnessTime;
/**
* 实际参与活动个数签到+1
* 实际参与活动个数
*/
private Integer participationNum;
@ -100,4 +100,4 @@ public class HeartUserInfoDTO implements Serializable {
*/
private Date updatedTime;
}
}

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

@ -60,19 +60,16 @@ public class ResiActInsertLiveFormDTO implements Serializable {
/**
* 活动签到位置经度
*/
@NotNull(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal longitude;
/**
* 活动签到位置纬度
*/
@NotNull(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal latitude;
/**
* 活动签到地址
*/
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class})
private String address;
/**

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java

@ -24,4 +24,6 @@ public class AactUserDetailFormDTO implements Serializable {
@NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class})
private String actUserRelationId;
@NotBlank(message = "当前活动id不能为空", groups = {UserHistoricalActFormDTO.AddUserInternalGroup.class})
private String currentActId;
}

2
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java

@ -49,7 +49,7 @@ public class ResiLeaderboardResultDTO implements Serializable {
private Boolean volunteerFlag;
/**
* 爱心时长(单位小时)
* 爱心时长(单位分钟)
*/
private Integer kindnessTime;

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

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-heart-server:
container_name: epmet-heart-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.24
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.30
ports:
- "8111:8111"
network_mode: host # 使用现有网络

2
epmet-module/epmet-heart/epmet-heart-server/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"
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>
<version>0.0.24</version>
<version>0.0.30</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-heart</artifactId>

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ActCustomizedController.java

@ -17,6 +17,8 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.work.ActCustomizedFormDTO;
@ -51,6 +53,7 @@ public class ActCustomizedController {
* @description 获取当前客户下爱心互助模块自定义配置项如果没有配置返回系统默认
* @Date 2020/7/20 15:42
**/
@RequirePermission(requirePermission = RequirePermissionEnum.MORE_HEART_CUSTOMIZED_VIEW)
@PostMapping("getconfigs")
public Result<ActCustomizedResultDTO> getConfigs(@RequestBody ActCustomizedFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ActCustomizedFormDTO.AddUserInternalGroup.class);
@ -65,6 +68,7 @@ public class ActCustomizedController {
* @description 保存自定义配置
* @Date 2020/7/20 17:25
**/
@RequirePermission(requirePermission = RequirePermissionEnum.MORE_HEART_CUSTOMIZED_SAVE)
@PostMapping("save")
public Result saveConfigs(@RequestBody SaveActCustomizedFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SaveActCustomizedFormDTO.AddUserShowGroup.class,SaveActCustomizedFormDTO.AddUserInternalGroup.class);

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java

@ -239,7 +239,7 @@ public class ResiActListController {
* @Date 11:21 2020-07-28
**/
@PostMapping("checksigninaddress")
public Result<ResiActAddressResultDTO> cancelSignUp(@RequestBody ResiActCaculateDistanceFormDTO formDTO) {
public Result<ResiActAddressResultDTO> checkSignInAddress(@RequestBody ResiActCaculateDistanceFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActCaculateDistanceFormDTO.AddUserInternalGroup.class);
return actInfoService.checkSignInAddress(formDTO);
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java

@ -97,11 +97,12 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
/**
* @return java.lang.Integer
* @param userId
* @param currentActId
* @author yinzuomei
* @description 报名活动个数act_user_realation
* @Date 2020/7/23 15:57
**/
Integer countSignUpActNum(String userId);
Integer countSignUpActNum(@Param("userId")String userId,@Param("currentActId") String currentActId);
/**
* @return java.lang.Integer

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/HeartUserInfoEntity.java

@ -57,7 +57,7 @@ public class HeartUserInfoEntity extends BaseEpmetEntity {
private Integer kindnessTime;
/**
* 实际参与活动个数签到+1
* 实际参与活动个数
*/
private Integer participationNum;

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java

@ -38,6 +38,7 @@ import com.epmet.dao.ActSignInRecDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActSignInRecDTO;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.entity.ActSignInPicEntity;
@ -45,6 +46,7 @@ import com.epmet.entity.ActSignInRecEntity;
import com.epmet.redis.ActSignInRecRedis;
import com.epmet.service.ActLiveRecService;
import com.epmet.service.ActSignInRecService;
import com.epmet.service.HeartUserInfoService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -76,6 +78,9 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
@Autowired
private ActLiveRecService actLiveRecService;
// @Autowired
// private HeartUserInfoService heartUserInfoService;
private Logger logger = LogManager.getLogger(ActSignInRecServiceImpl.class);
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@ -124,6 +129,13 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
actSignInPicDao.insert(actLivePicEntity);
}
}
// 用户信息表,实际参与活动个数(签到+1)
// 暂时注释掉,将(实际参与活动个数)字段,放在活动结束后进行统计
// HeartUserInfoDTO heartUserInfoDTO = new HeartUserInfoDTO();
// heartUserInfoDTO.setUserId(formDTO.getUserId());
// heartUserInfoDTO.setParticipationNum(NumConstant.ONE);
// heartUserInfoService.updateHeartUserInfoByUserId(heartUserInfoDTO);
return new Result();
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -819,7 +819,7 @@ public class WorkActServiceImpl implements WorkActService {
//act_info表改为已完成
actInfoDTO.setActStatus(ActConstant.ACT_STATUS_FINISHED);
actInfoService.update(actInfoDTO);
//发放爱心时长、参与活动并获得积分的次数
//发放爱心时长、参与活动并获得积分的次数、实际参与活动个数
updateHeartUserInfo(actInfoDTO);
//保存结束活动日志
this.saveActOperationRec(actId);
@ -950,8 +950,10 @@ public class WorkActServiceImpl implements WorkActService {
if(null==heartUserInfoDTO){
continue;
}
boolean updateFlag=false;
if(actInfoDTO.getReward()>0){
if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){
updateFlag=true;
heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1);
}
}
@ -959,6 +961,7 @@ public class WorkActServiceImpl implements WorkActService {
//爱心时长发放(签到的。未签到但是有积分的)
if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){
//已签到的
updateFlag=true;
heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin());
UserKindnessTimeLogEntity userKindnessTimeLogEntity=new UserKindnessTimeLogEntity();
userKindnessTimeLogEntity.setActId(actInfoDTO.getId());
@ -968,6 +971,7 @@ public class WorkActServiceImpl implements WorkActService {
}else{
//未签到,但是有积分的
if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){
updateFlag=true;
heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin());
UserKindnessTimeLogEntity userKindnessTimeLogEntity=new UserKindnessTimeLogEntity();
userKindnessTimeLogEntity.setActId(actInfoDTO.getId());
@ -977,7 +981,17 @@ public class WorkActServiceImpl implements WorkActService {
}
}
}
if(actInfoDTO.getReward()>0||actInfoDTO.getServiceMin()>0){
//审核通过并且已经签到的更新实际参与活动数,+1
if (ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())
&& ActConstant.ACT_USER_STATUS_PASSED.equals(actUserRelation.getStatus())) {
updateFlag = true;
if (null != heartUserInfoDTO.getParticipationNum() && heartUserInfoDTO.getParticipationNum() >= 0) {
heartUserInfoDTO.setParticipationNum(heartUserInfoDTO.getParticipationNum() + 1);
} else if (null == heartUserInfoDTO.getParticipationNum()) {
heartUserInfoDTO.setParticipationNum(NumConstant.ONE);
}
}
if (updateFlag) {
heartUserInfoService.update(heartUserInfoDTO);
}
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java

@ -348,7 +348,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
*/
resultDTO.setStatus(actUserRelationDTO.getStatus());
HistoricalActInfo historicalActInfo=this.getHistoricalActInfo(actUserRelationDTO.getUserId());
HistoricalActInfo historicalActInfo=this.getHistoricalActInfo(actUserRelationDTO.getUserId(),formDTO.getCurrentActId());
resultDTO.setHistoricalActInfo(historicalActInfo);
if(ActConstant.ACT_USER_STATUS_AUDITING.equals(resultDTO.getStatus())){
//被拒绝过,才赋值
@ -399,7 +399,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
resultDTO.setRealName(userBaseInfoResultDTO.getRealName());
}
//参与活动统计值
HistoricalActInfo historicalActInfo=getHistoricalActInfo(formDTO.getUserId());
HistoricalActInfo historicalActInfo=getHistoricalActInfo(formDTO.getUserId(),formDTO.getCurrentActId());
resultDTO.setSignInActNum(historicalActInfo.getSignInActNum());
//减去当前的
resultDTO.setSignUpActNum(historicalActInfo.getSignUpActNum());
@ -639,11 +639,12 @@ public class WorkActUserServiceImpl implements WorkActUserService {
/**
* @return com.epmet.dto.result.work.HistoricalActInfo
* @param userId
* @param currentActId
* @author yinzuomei
* @description 用户历史活动情况
* @Date 2020/7/23 15:56
**/
private HistoricalActInfo getHistoricalActInfo(String userId) {
private HistoricalActInfo getHistoricalActInfo(String userId,String currentActId) {
HistoricalActInfo historicalActInfo=new HistoricalActInfo();
/**
* 实际参加活动个数(已经签到的)
@ -653,7 +654,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
/**
* 报名活动个数act_user_realation
*/
Integer signUpActNum=actUserRelationDao.countSignUpActNum(userId);
Integer signUpActNum=actUserRelationDao.countSignUpActNum(userId,currentActId);
historicalActInfo.setSignUpActNum(signUpActNum);
/**
* 获得积分活动个数

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql

@ -350,7 +350,7 @@ CREATE TABLE `heart_user_info` (
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`VOLUNTEER_FLAG` tinyint(1) NOT NULL COMMENT '1是志愿者,0不是志愿者(志愿者注册成功后需要来更新值)',
`KINDNESS_TIME` int(11) NOT NULL DEFAULT 0 COMMENT '爱心时长(单位:分钟)(参与并签到了的活动,实际结束-实际开始)签到的。未签到但是有积分的\r\n',
`PARTICIPATION_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '实际参与活动个数(签到+1)',
`PARTICIPATION_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '实际参与活动个数',
`OBTAIN_POINT_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '参与活动并获得积分的次数(结束活动时,如果给用户发放积分则该数值+1)',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',

9
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

@ -333,6 +333,7 @@
AND r.USER_ID = #{userId}
AND NOW() BETWEEN DATE_SUB(i.ACT_START_TIME, INTERVAL 1 HOUR) AND i.ACT_END_TIME
AND i.ACT_STATUS = 'published'
AND r.`STATUS` = 'passed'
</select>
<!--活动回顾列表-->
@ -347,10 +348,12 @@
i.ACT_ADDRESS actAddress,
'finished' actCurrentState
FROM act_info i
LEFT JOIN act_live_rec r ON r.ACT_ID = i.ID AND r.DEL_FLAG = '0'
WHERE i.DEL_FLAG = '0'
AND i.SUMMARY_FLAG = 1 OR (SELECT r.ACT_ID FROM act_live_rec r WHERE r.DEL_FLAG = '0' AND r.ACT_ID = i.ID GROUP BY r.ACT_ID)
AND i.SUMMARY_FLAG = 1 OR r.ID is NOT NULL
AND i.CUSTOMER_ID = #{customerId}
AND i.ACT_STATUS = 'finished'
GROUP BY r.ACT_ID
ORDER BY i.CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}
</select>
@ -710,10 +713,12 @@
i.ACT_ADDRESS actAddress,
'finished' actCurrentState
FROM act_info i
LEFT JOIN act_live_rec r ON r.ACT_ID = i.ID AND r.DEL_FLAG = '0'
WHERE i.DEL_FLAG = '0'
AND i.SUMMARY_FLAG = 1 OR (SELECT r.ACT_ID FROM act_live_rec r WHERE r.DEL_FLAG = '0' AND r.ACT_ID = i.ID GROUP BY r.ACT_ID)
AND i.SUMMARY_FLAG = 1 OR r.ID is NOT NULL
AND i.CUSTOMER_ID = #{customerId}
AND i.ACT_STATUS = 'finished'
GROUP BY r.ACT_ID
ORDER BY i.CREATED_TIME DESC
LIMIT 0, #{num}
</select>

5
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml

@ -114,7 +114,7 @@
</select>
<!-- 报名活动个数(act_user_realation) -->
<select id="countSignUpActNum" resultType="java.lang.Integer" parameterType="java.lang.String">
<select id="countSignUpActNum" resultType="java.lang.Integer" parameterType="map">
SELECT
count( 1 ) as total
FROM
@ -123,6 +123,9 @@
DEL_FLAG = '0'
and acu.STATUS !='auditing'
AND acu.USER_ID = #{userId}
<if test="currentActId != null and currentActId != ''">
and acu.ACT_ID != #{currentActId}
</if>
</select>
<!-- 获得积分活动个数 -->

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml

@ -65,7 +65,7 @@
KINDNESS_TIME = #{kindnessTime},
</if>
<if test="participationNum != null and participationNum != ''">
PARTICIPATION_NUM = #{participationNum},
PARTICIPATION_NUM = PARTICIPATION_NUM + #{participationNum},
</if>
<if test="obtainPointNum != null and obtainPointNum != ''">
OBTAIN_POINT_NUM = #{obtainPointNum},

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

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

2
epmet-module/epmet-message/epmet-message-server/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"
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>
<version>0.3.25</version>
<version>0.3.27</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-message</artifactId>

3
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/UserMessageServiceImpl.java

@ -149,7 +149,8 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User
QueryWrapper<UserMessageEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id)
.eq(StringUtils.isNotBlank(customerId), FieldConstant.CUSTOMER_ID, customerId)
.eq(StringUtils.isNotBlank(gridId), FieldConstant.GRID_ID, gridId)
// 注释掉此列,居民端和工作端消息浮窗看到的是当前客户下所有的消息
// .eq(StringUtils.isNotBlank(gridId), FieldConstant.GRID_ID, gridId)
.eq(StringUtils.isNotBlank(userId), FieldConstant.USER_ID, userId)
.eq(StringUtils.isNotBlank(deFlag), FieldConstant.DEL_FLAG, deFlag)
.eq(StringUtils.isNotBlank(readFlag), "read_flag", readFlag);

6
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/UserMessageDao.xml

@ -40,10 +40,8 @@
user_message
WHERE
del_flag = '0'
AND (
CUSTOMER_ID = #{customerId}
AND GRID_ID = #{gridId}
AND USER_ID = #{userId})
AND CUSTOMER_ID = #{customerId}
AND USER_ID = #{userId}
ORDER BY
CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}

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

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-point-server:
container_name: epmet-point-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.16
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.21
ports:
- "8112:8112"
network_mode: host # 使用现有网络

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

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.16</version>
<version>0.0.21</version>
<parent>
<artifactId>epmet-point</artifactId>
<groupId>com.epmet</groupId>

15
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java

@ -6,9 +6,7 @@ import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -17,20 +15,21 @@ import java.util.Map;
/**
* desc:订阅积分事件
*/
@Component
//@Component
public class MqSubcribeConfig {
private Logger logger = LogManager.getLogger(MqSubcribeConfig.class);
private String mqServer = "https://epmet-dev.elinkservice.cn/estos/mq-subscriber/subscribe";
private String token = "1cfcbb5ade1e3202855ee5819983d773";
@PostConstruct
//todo 由于api订阅报错 暂时通过页面订阅
//@PostConstruct
private void subscribe() {
MqSubscribeFormDTO event = new MqSubscribeFormDTO();
event.setBelongAppId("202007161443499985fa2d397436d10356542134c8f008c48");
event.setEventClass("epmet_heart");
event.setEventTag("active_send_point");
String callbackUrl = "http://192.168.1.119/point/callback/sendPoint";
event.setBelongAppId("202007151206522723ab739c43c73afe1e696f88ef4ee45a9");
event.setEventClass("test_event_cls_1");
event.setEventTag("test_event_1");
String callbackUrl = "http://118.190.150.119/testpub/test/post";
//callbackUrl = "";
event.setCallbackUrl(callbackUrl);
List<MqSubscribeFormDTO> subscribeFormDTOList = new ArrayList<>();

6
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java

@ -2,6 +2,8 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -42,6 +44,7 @@ public class AdjustmentController {
* @date 2020.07.27 10:57
**/
@PostMapping("userlist")
@RequirePermission(requirePermission = RequirePermissionEnum.MORE_POINT_USER_MANAGE_LIST)
public Result<List<CustomerUser4PointResultDTO>> userList(@RequestBody CustomerUserFormDTO param){
ValidatorUtils.validateEntity(param, CustomerUserFormDTO.CustomerIdGroup.class);
return epmetUserOpenFeignClient.customerUserList(param);
@ -55,6 +58,7 @@ public class AdjustmentController {
* @date 2020.07.27 11:15
**/
@PostMapping("userdetail")
@RequirePermission(requirePermission = RequirePermissionEnum.MORE_POINT_USER_MANAGE_DETAIL_VIEW)
public Result<CustomerUserDetailResultDTO> userDetail(@RequestBody IssueInitiatorFormDTO param){
ValidatorUtils.validateEntity(param,IssueInitiatorFormDTO.UserIdGroup.class);
return new Result<CustomerUserDetailResultDTO>().ok(pointAdjustmentLogService.userDetail(param));
@ -68,6 +72,7 @@ public class AdjustmentController {
* @date 2020.07.27 10:51
**/
@PostMapping("adjustrecord")
@RequirePermission(requirePermission = RequirePermissionEnum.MORE_POINT_USER_MANAGE_ADJUST_REC_VIEW)
public Result<List<PointAdjustmentResultDTO>> adjustRecord(@RequestBody IssueInitiatorFormDTO param){
ValidatorUtils.validateEntity(param, IssueInitiatorFormDTO.UserIdGroup.class);
return new Result<List<PointAdjustmentResultDTO>>().ok(pointAdjustmentLogService.adjustRecord(param));
@ -81,6 +86,7 @@ public class AdjustmentController {
* @date 2020.07.27 13:52
**/
@PostMapping("adjust")
@RequirePermission(requirePermission = RequirePermissionEnum.MORE_POINT_USER_MANAGE_ADJUST_POINT)
public Result adjustPoint(@LoginUser TokenDto token, @RequestBody PointAdjustmentFormDTO param){
param.setOperatorId(token.getUserId());
param.setCustomerId(token.getCustomerId());

6
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java

@ -1,6 +1,8 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -40,6 +42,7 @@ public class PointRuleController {
* @return
*/
@PostMapping(value = "functionlist")
@RequirePermission( requirePermission = RequirePermissionEnum.MORE_POINT_RULE_FUNCTION_LIST)
public Result<List<CustomerFunctionResultDTO>> getFunctionList(@LoginUser TokenDto tokenDTO) {
return new Result<List<CustomerFunctionResultDTO>>().ok(pointRuleService.getFunctionList(tokenDTO.getCustomerId()));
}
@ -52,6 +55,7 @@ public class PointRuleController {
* @return
*/
@PostMapping(value = "list")
@RequirePermission( requirePermission = RequirePermissionEnum.MORE_POINT_RULE_LIST)
public Result<List<PointRuleResultDTO>> list( @RequestBody PointRuleListFormDTO formDTO) {
formDTO.setCustomerId("3ef7e4bb195eb9e622d68b52509aa940");
ValidatorUtils.validateEntity(formDTO);
@ -65,6 +69,7 @@ public class PointRuleController {
* @return
*/
@PostMapping(value = "detail")
@RequirePermission( requirePermission = RequirePermissionEnum.MORE_POINT_RULE_DETAIL)
public Result<PointDetailResultDTO> detail(@RequestBody PointDetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<PointDetailResultDTO>().ok(pointRuleService.detail(formDTO));
@ -77,6 +82,7 @@ public class PointRuleController {
* @return
*/
@PostMapping(value = "update")
@RequirePermission( requirePermission = RequirePermissionEnum.MORE_POINT_RULE_SAVE)
public Result<Boolean> update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointActionLogDao.java

@ -23,6 +23,7 @@ import com.epmet.entity.UserPointActionLogEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
@ -50,5 +51,5 @@ public interface UserPointActionLogDao extends BaseDao<UserPointActionLogEntity>
* @author wangc
* @date 2020.07.31 15:11
**/
Integer selectSumByEvent(@Param("userId") String userId,@Param("eventId") String eventId, @Param("sourceId") String sourceId,@Param("customerId") String customerId);
Integer selectSumByEvent(@Param("userId") String userId, @Param("eventId") String eventId, @Param("sourceId") String sourceId, @Param("customerId") String customerId, @Param("dateCheck") Date dateCheck);
}

4
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/redis/PointRedis.java

@ -26,6 +26,10 @@ public class PointRedis {
return redisUtils.lindex(RedisKeys.getPointVerificationResultKey(userId),index);
}
public Object rpop(String userId){
return redisUtils.rightPop(RedisKeys.getPointVerificationResultKey(userId));
}
public String checkIfQrCodeExpire(String shortId){
String userId = (String)redisUtils.getString(RedisKeys.getShortUserIdKey(shortId));
return userId;

19
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java

@ -156,7 +156,7 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
Map<String, List<ResiPointLogPeriodResultDTO>> sortedMap = Maps.newLinkedHashMap();
map.entrySet().stream().sorted(Map.Entry.<String, List<ResiPointLogPeriodResultDTO>>comparingByKey().reversed())
.forEachOrdered(e -> sortedMap.put(e.getKey(), e.getValue()));
map.entrySet().forEach(e -> {
sortedMap.entrySet().forEach(e -> {
ResiPointLogListResultDTO o = new ResiPointLogListResultDTO();
o.setDate(e.getKey());
o.setDailyList(e.getValue());
@ -238,17 +238,19 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
@Override
@Transactional(rollbackFor = Exception.class)
public PointVerificationResultDTO verifyPoint(PointVerificationFormDTO verificationParam) {
PointVerificationResultDTO result = new PointVerificationResultDTO();
String decodedUserId = pointRedis.checkIfQrCodeExpire(verificationParam.getUserId());
if(StringUtils.isNotBlank(decodedUserId)){
verificationParam.setUserId(decodedUserId);
}else{
logger.error(String.format("用户二维码失效,参数详情 -> 【】", JSON.toJSON(verificationParam)));
throw new RenException("用户二维码失效");
logger.error(String.format("用户二维码失效,参数详情 -> 【%s】", JSON.toJSON(verificationParam)));
result.setSuccessFlag(false);
result.setFailureReason(ModuleConstant.INVALID_USER_QRCDDE);
return result;
}
DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(new Date());
PointVerificationResultDTO result = new PointVerificationResultDTO();
ResiCommonUserIdFormDTO userId = new ResiCommonUserIdFormDTO();
userId.setUserId(verificationParam.getUserId());
ResiPointDetailResultDTO currentPoint = userPointTotalService.getMyPoint(userId);
@ -328,8 +330,8 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
UserPointTotalEntity userPoint = new UserPointTotalEntity();
userPoint.setUserId(verificationParam.getUserId());
userPoint.setCustomerId(customerId);
//负数
userPoint.setTotalPoint(point);
//总数不变
userPoint.setTotalPoint(NumConstant.ZERO);
//负数
userPoint.setUsablePoint(point);
//正数
@ -369,7 +371,8 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
**/
@Override
public PointExchangeResponseResultDTO resiExchangeCallback(String userId) {
return (PointExchangeResponseResultDTO)pointRedis.lindex(userId,NumConstant.ZERO_L);
// return (PointExchangeResponseResultDTO)pointRedis.lindex(userId,NumConstant.ZERO_L);
return (PointExchangeResponseResultDTO)pointRedis.rpop(userId);
}
/**

51
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java

@ -32,7 +32,6 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.form.PointRuleListFormDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.entity.PointRuleEntity;
@ -49,8 +48,6 @@ import com.google.common.collect.Maps;
import dto.form.SendPointFormDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.bouncycastle.math.raw.Mod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -193,30 +190,47 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
logger.error(String.format("无法识别事件类型与积分规则,消息体->【%s】", JSON.toJSON(event)));
throw new RenException("无法识别事件类型与积分规则");
}
PointRuleEntity ruleInfo = pointRuleService.getByEventCodeAndCustomerId(event.getCustomerId(),eventCode);
if(null != ruleInfo && StringUtils.equals(NumConstant.ONE_STR,ruleInfo.getEnabledFlag())){
Date dateCheck = null;
//判断积分规则的积分单位 次、天、分钟、小时
if(StringUtils.equals(ModuleConstant.POINT_UNIT_TIME,ruleInfo.getPointUnit())){
//次
}else if(StringUtils.equals(ModuleConstant.POINT_UNIT_DAY,ruleInfo.getPointUnit())){
//天
//在selectSumByEvent时要校验时间区间
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.HOUR_OF_DAY, NumConstant.ZERO);
calendar.set(Calendar.MINUTE, NumConstant.ZERO);
calendar.set(Calendar.SECOND, NumConstant.ZERO);
dateCheck = calendar.getTime();
}else{
//其余积分单位
//TODO..
logger.warn(String.format("当前规则属于按%s计分,系统尚不支持响应此类积分规则的事件"),ruleInfo.getPointUnit());
}
//校验是否达到上限
if(ruleInfo.getUpLimit() > NumConstant.ZERO){
Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,event.getSourceId(),event.getCustomerId());
Integer sum = baseDao.selectSumByEvent(event.getUserId(),eventCode,event.getSourceId(),event.getCustomerId(),dateCheck);
if(null == sum) sum = NumConstant.ZERO;
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_PLUS,ruleInfo.getOperateType())){
sum += ruleInfo.getPoint();
if(ruleInfo.getPoint() < NumConstant.ZERO){
//保证要加的积分是正数
ruleInfo.setPoint(ruleInfo.getPoint() * NumConstant.ONE_NEG);
}
sum += ruleInfo.getPoint();
}else{
//actionLog中存的是正负数,如果是减操作,则算出来的是负数相加
sum -= ruleInfo.getPoint() * NumConstant.ONE_NEG;
sum *= NumConstant.ONE_NEG;
if(ruleInfo.getPoint() > NumConstant.ZERO){
//保证要扣减的积分是负数
ruleInfo.setPoint(ruleInfo.getPoint() * NumConstant.ONE_NEG);
}
sum += ruleInfo.getPoint();
sum *= NumConstant.ONE_NEG;
}
//这里sum一定是正数
if(ruleInfo.getUpLimit() < (sum + ruleInfo.getPoint())){
if(ruleInfo.getUpLimit() < sum){
log.info(String.format("该用户获取此类事件的积分已达上限,详细数据->【%s】", JSON.toJSON(event)));
return ;
}
@ -224,14 +238,27 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
//完成校验,可以进行积分操作
//根据事件的类型,提前定义好EventName、EventStatement等属性
String eventName = ModuleConstant.EMPTY_STR;
String eventStatement = eventName;
if(EventEnum.ACTIVE_INSERT_LIVE.getEventTag().equals(eventCode)){
eventName = ModuleConstant.EVENT_NAME_VOLUNTEER;
}else if(EventEnum.REGISTER_VOLUNTEER.getEventTag().equals(eventCode)){
eventName = ModuleConstant.EVENT_NAME_PARTICIPATED_ACT;
eventStatement = event.getRemark();
}else{
eventName = EventEnum.getEnum(eventCode).getEventDesc();
eventStatement = event.getRemark();
}
//1.新增用户积分行为记录
UserPointActionLogEntity action = new UserPointActionLogEntity();
action.setCustomerId(event.getCustomerId());
//正负数
action.setPoint(ruleInfo.getPoint());
action.setEventStatement(event.getRemark());
action.setEventName(EventEnum.getEnum(eventCode).getEventDesc());
action.setEventStatement(eventStatement);
action.setEventName(eventName);
action.setEventId(eventCode);
action.setActionFlag(event.getActionFlag());
action.setUserId(event.getUserId());
@ -243,6 +270,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
//2.新增/修改用户积分日统计
DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date());
UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dimVal,UserPointStatisticalDailyEntity.class);
//正负数
statistical.setPointChange(ruleInfo.getPoint());
statistical.setActionFlag(event.getActionFlag());
statistical.setCustomerId(event.getCustomerId());
@ -254,6 +282,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
UserPointTotalEntity point = new UserPointTotalEntity();
point.setCustomerId(event.getCustomerId());
point.setUserId(event.getUserId());
//正负数
point.setTotalPoint(ruleInfo.getPoint());
point.setUsablePoint(ruleInfo.getPoint());
point.setUsedPoint(NumConstant.ZERO);

26
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -92,4 +92,30 @@ public interface ModuleConstant extends Constant {
String POINT_NOT_ENOUGH = "积分余额不足";
String CREATED_BY_SYSTEM = "SYSTEM";
String INVALID_USER_QRCDDE = "用户二维码失效";
/**
* 积分单位
* */
String POINT_UNIT_TIME = "time";
/**
* 积分单位
* */
String POINT_UNIT_DAY = "day";
/**
* 积分单位分钟
* */
String POINT_UNIT_MINUTE = "minute";
/**
* 积分单位小时
* */
String POINT_UNIT_HOUR = "hour";
String EVENT_NAME_VOLUNTEER = "志愿者认证";
String EVENT_NAME_PARTICIPATED_ACT = "参与活动";
}

5
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml

@ -49,13 +49,16 @@
WHERE
DEL_FLAG = '0'
AND USER_ID = #{userId}
AND EVENT_ID = #{eventCode}
AND EVENT_ID = #{eventId}
<if test='null != customerId and "" != customerId'>
AND CUSTOMER_ID = #{customerId}
</if>
<if test='null != sourceId and "" != sourceId'>
AND SOURCE_ID = #{sourceId}
</if>
<if test="null != dateCheck">
AND CREATED_TIME <![CDATA[ >= ]]> #{dateCheck}
</if>
</select>
</mapper>

4
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml

@ -36,9 +36,9 @@
(
SELECT
total.USER_ID,
IFNULL( SUM( daily.POINT_CHANGE ), 0 ) AS POINT_CHANGE,
IF
( POINT_CHANGE <![CDATA[ < ]]> 0, 0, IFNULL( SUM( daily.POINT_CHANGE ), 0 ) ) AS TOTAL_POINT
( IFNULL( SUM( daily.POINT_CHANGE ), 0 ) <![CDATA[ < ]]> 0, 0, IFNULL( SUM( daily.POINT_CHANGE ), 0 ) ) AS TOTAL_POINT
FROM
user_point_total total
LEFT JOIN user_point_statistical_daily daily ON daily.USER_ID = total.USER_ID

86
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/FixationAppIdDTO.java

@ -0,0 +1,86 @@
/**
* 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;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 固定的AppId表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-03
*/
@Data
public class FixationAppIdDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 小程序AppId
*/
private String appId;
/**
* 客户Id
*/
private String customerId;
/**
* 客户端类型resi居民端work工作端
*/
private String clientType;
/**
* 删除状态0:正常已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

26
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ModifyCustomerFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* @Description 修改各业务表customerId(兼容党群e事通已上线客户将已有客户Id同步到第三方问题)-接口入参
*/
@Data
public class ModifyCustomerFormDTO implements Serializable {
private static final long serialVersionUID = -6547893374373422628L;
/**
* 待修改的客户Id 公众号创建的客户
* */
private String oldCustomerId;
/**
* 修改后的客户Id crm表原来的customerId
*/
private String newCustomerId;
}

30
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/FixationAppIdResultDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/3 4:15 下午
*/
@Data
public class FixationAppIdResultDTO implements Serializable {
private static final long serialVersionUID = 3810567059789358255L;
/**
* 客户ID
*/
private String masterCustomerId;
/**
* 客户端类型resi居民端work工作端
*/
private String clientType;
/**
* AppId
*/
private String appId;
}

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

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-third-server:
container_name: epmet-third-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.92
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.93
ports:
- "8110:8110"
network_mode: host # 使用现有网络

2
epmet-module/epmet-third/epmet-third-server/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"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.92</version>
<version>0.0.93</version>
<parent>
<groupId>com.epmet</groupId>

15
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java

@ -86,6 +86,21 @@ public interface ModuleConstant {
String AUDIT_FAILED = "audit_failed";
String XML = "xml";
String CREATE_TIME = "CreateTime";
String QUERY_AUTH_CODE = "QUERY_AUTH_CODE";
String _CALL_BACK = "_callback";
String FROM_CALLBACK = "from_callback";
String APPLICATION_JSON = "application/json";
String _FROM_API = "_from_api";
/**
* 微信模推送给第三方平台方 Content固定格式
*/
String TESTCOMPONENT_MSG_TYPE_TEXT = "TESTCOMPONENT_MSG_TYPE_TEXT";
/**
* 第三方平台方立马回应文本消息并最终触达粉丝 Content固定格式
*/
String TESTCOMPONENT_MSG_TYPE_TEXT_callback = "TESTCOMPONENT_MSG_TYPE_TEXT_callback";
int FORTY_THOUSAND_AND_THIRTEEN = 40013;
int EIGHTY_NINE_THOUSAND = 89000;

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java

@ -78,4 +78,8 @@ public interface PaConstant {
* 获取访问记录表数据失败失败
*/
String SELECT_VISITED_EXCEPTION = "获取访问记录表数据失败";
/**
* 更新客户Id信息失败
*/
String UPDATE_CUSTOMER_EXCEPTION = "更新客户Id信息失败";
}

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java

@ -103,4 +103,8 @@ public interface ThirdRunTimeInfoConstant {
String BEGIN_CREATE_OPEN = "============================开始执行绑定开放平台账号===================================";
String CODE_AUDIT_RESULT = "----------------------------------代码审核结果即将插入,需要插入的内容为:%s-----------------------------------------";
String TEXT_MESSAGE_LOG_INFO = "content:%s,content[1]:%s,fromUserName:%s,toUserName:%s";
String SEND_MESSAGE_XML = "要发送的xml内容为:%s";
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerMpDTO;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.form.AuthCodeFormDTO;
import com.epmet.dto.form.ModifyCustomerFormDTO;
import com.epmet.entity.CustomerMpEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -123,4 +124,12 @@ public interface CustomerMpDao extends BaseDao<CustomerMpEntity> {
* @author zxc
*/
String getAppId(@Param("customerId")String customerId,@Param("clientType")String clientType);
/**
* @param formDTO
* @return
* @Author sun
* @Description 修改customer_mp表客户Id
**/
int updateCustomerId(ModifyCustomerFormDTO formDTO);
}

43
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/FixationAppIdDao.java

@ -0,0 +1,43 @@
/**
* 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.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.FixationAppIdResultDTO;
import com.epmet.entity.FixationAppIdEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 固定的AppId表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-03
*/
@Mapper
public interface FixationAppIdDao extends BaseDao<FixationAppIdEntity> {
/**
* @Description 查询固定AppId信息
* @author zxc
* @date 2020/8/3 4:25 下午
*/
List<FixationAppIdResultDTO> selectFixationInfos();
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaCustomerAgencyDTO;
import com.epmet.dto.form.ModifyCustomerFormDTO;
import com.epmet.entity.PaCustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -54,4 +55,12 @@ public interface PaCustomerAgencyDao extends BaseDao<PaCustomerAgencyEntity> {
* @Description 公众号-查询客户组织信息
**/
PaCustomerAgencyDTO selectAgency(@Param("customerId") String customerId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 修改pa_customer_agency表客户Id
**/
int updateCustomerId(ModifyCustomerFormDTO formDTO);
}

8
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.form.ModifyCustomerFormDTO;
import com.epmet.dto.form.RegisterByAuthFormDTO;
import com.epmet.dto.result.CustomerAgencyResultDTO;
import com.epmet.dto.result.RegisterByAuthResultDTO;
@ -69,4 +70,11 @@ public interface PaCustomerDao extends BaseDao<PaCustomerEntity> {
**/
List<RegisterByAuthResultDTO> selectCustomerList(RegisterByAuthFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 修改pa_customer表主键值
**/
int updateIdById(ModifyCustomerFormDTO formDTO);
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaCustomerUserAgencyDTO;
import com.epmet.dto.form.ModifyCustomerFormDTO;
import com.epmet.entity.PaCustomerUserAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -47,4 +48,12 @@ public interface PaCustomerUserAgencyDao extends BaseDao<PaCustomerUserAgencyEnt
* @Description 根据userId查询客户信息
**/
PaCustomerUserAgencyDTO selectCustomerIdByUserId(@Param("userId") String userId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 修改pa_customer_user_agency表客户Id
**/
int updateCustomerId(ModifyCustomerFormDTO formDTO);
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.form.CheckPaUserFormDTO;
import com.epmet.dto.form.CustomerManagerFormDTO;
import com.epmet.entity.PaUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -58,4 +59,12 @@ public interface PaUserDao extends BaseDao<PaUserEntity> {
* @Description 根据数据来源和手机号查询公众号用户基本信息校验用户是否存在
**/
PaUserDTO selectUser(@Param("id") String id, @Param("source") String source);
/**
* @Description 查询管理员基本信息
* @param customerId
* @author zxc
* @date 2020/8/3 5:21 下午
*/
CustomerManagerFormDTO selectManagerInfo(@Param("customerId") String customerId);
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/FixationAppIdEntity.java

@ -0,0 +1,56 @@
/**
* 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.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 固定的AppId表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-03
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fixation_app_id")
public class FixationAppIdEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 小程序AppId
*/
private String appId;
/**
* 客户Id
*/
private String customerId;
/**
* 客户端类型resi居民端work工作端
*/
private String clientType;
}

13
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java

@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.form.CreateAgencyFormDTO;
import com.epmet.dto.form.RegisterByAuthFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.form.RegisterInfoFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.PaCustomerEntity;
@ -163,4 +160,12 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
* @Description 根据初始化状态获取公众号注册的客户列表
**/
List<RegisterByAuthResultDTO> registerByAuth(RegisterByAuthFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 修改各业务表customerId(兼容党群e事通已上线客户将已有客户Id同步到第三方问题)
**/
void modifyCustomer(ModifyCustomerFormDTO formDTO);
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java

@ -15,6 +15,7 @@ import com.epmet.dao.*;
import com.epmet.dto.PaCustomerUserAgencyDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.mpaes.WXBizMsgCrypt;
import com.epmet.mpaes.WXXmlToMapUtil;
import com.epmet.redis.RedisThird;
@ -79,6 +80,14 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
private AuthResultRecordDao authResultRecordDao;
@Autowired
private PaCustomerUserAgencyDao paCustomerUserAgencyDao;
@Autowired
private FixationAppIdDao fixationAppIdDao;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private PaUserDao paUserDao;
@Autowired
private PaCustomerServiceImpl paCustomerServiceImpl;
@Value("${third.platform.appId}")
private String componentAppId;
@ -386,8 +395,11 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
String authCode = authCodeAndTime.getAuthCode();
String clientType = authCodeAndTime.getClientType();
String expiresIn = authCodeAndTime.getExpiresIn();
// 公众号创建客户的id
String customerId = this.getLoginUserCustomerId(tokenDto);
Date expiresInTime = this.countExpirationTime(expiresIn);
//authCode存数据库
AuthCodeFormDTO formDTO = new AuthCodeFormDTO();
formDTO.setAuthCode(authCode);
@ -402,6 +414,32 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
// 1. 开始获取授权信息(使用授权码)
AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, customerId, clientType);
String authAppId = authorizationInfoResultDTO.getAuthorizer_appid();
List<FixationAppIdResultDTO> fixationAppIdResultDTOS = fixationAppIdDao.selectFixationInfos();
String finalCustomerId = customerId;//
fixationAppIdResultDTOS.forEach(fixationAppId -> {
if (fixationAppId.getAppId().equals(authAppId)){
// TODO 是城阳项目或者党群e事通
// crm表中的customerId【原customerId】
String masterCustomerId = fixationAppId.getMasterCustomerId();
formDTO.setCustomerId(masterCustomerId);
authCodeDao.deleteCustomerAuthCode(finalCustomerId,clientType);
authCodeDao.insertRedirectAuthCode(formDTO);
//authCode存缓存
redisThird.setAuthCode(formDTO);
ModifyCustomerFormDTO modifyCustomer = new ModifyCustomerFormDTO();
modifyCustomer.setOldCustomerId(finalCustomerId);
modifyCustomer.setNewCustomerId(masterCustomerId);
paCustomerServiceImpl.modifyCustomer(modifyCustomer);
// 管理员授权
CustomerManagerFormDTO customerManager = paUserDao.selectManagerInfo(finalCustomerId);
customerManager.setCustomerId(finalCustomerId);
operCrmOpenFeignClient.addManager(customerManager);
}
});
//替换 新customerId为旧customerId
customerId = formDTO.getCustomerId();
// 2. 创建开放平台账号并绑定 或者 直接绑定开放平台
this.createAndBindOpenAccount(customerId,authAppId,clientType);
// 3. 更新 customer_mp 表授权状态和AuthAppId

37
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java

@ -34,10 +34,7 @@ import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.constant.PaConstant;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.CreateAgencyFormDTO;
import com.epmet.dto.form.RegisterByAuthFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.form.RegisterInfoFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.redis.PaCustomerRedis;
@ -505,4 +502,36 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
return baseDao.selectCustomerList(formDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 修改各业务表customerId(兼容党群e事通已上线客户将已有客户Id同步到第三方问题)
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void modifyCustomer(ModifyCustomerFormDTO formDTO) {
//1.修改pa_customer表主键
if (baseDao.updateIdById(formDTO) < NumConstant.ONE) {
logger.error(String.format("修改pa_customer表Id失败,待修改的客户Id->%s,修改后的客户Id->%s", formDTO.getOldCustomerId(), formDTO.getNewCustomerId()));
throw new RenException(PaConstant.UPDATE_CUSTOMER_EXCEPTION);
}
//2.修改pa_customer_agency表customerId
if (paCustomerAgencyDao.updateCustomerId(formDTO) < NumConstant.ONE) {
logger.error(String.format("修改pa_customer_agency表客户Id失败,待修改的客户Id->%s,修改后的客户Id->%s", formDTO.getOldCustomerId(), formDTO.getNewCustomerId()));
throw new RenException(PaConstant.UPDATE_CUSTOMER_EXCEPTION);
}
//3.修改customer_mp表customerId
if (customerMpDao.updateCustomerId(formDTO) < NumConstant.ONE) {
logger.error(String.format("修改customer_mp表客户Id失败,待修改的客户Id->%s,修改后的客户Id->%s", formDTO.getOldCustomerId(), formDTO.getNewCustomerId()));
throw new RenException(PaConstant.UPDATE_CUSTOMER_EXCEPTION);
}
//4.修改pa_customer_user_agency表customerId
if (paCustomerUserAgencyDao.updateCustomerId(formDTO) < NumConstant.ONE) {
logger.error(String.format("修改pa_customer_user_agency表客户Id失败,待修改的客户Id->%s,修改后的客户Id->%s", formDTO.getOldCustomerId(), formDTO.getNewCustomerId()));
throw new RenException(PaConstant.UPDATE_CUSTOMER_EXCEPTION);
}
}
}

146
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java

@ -1,18 +1,29 @@
package com.epmet.service.impl;
import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.client.config.utils.IOUtils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdRedisKeyConstant;
import com.epmet.constant.ThirdRunTimeInfoConstant;
import com.epmet.dao.*;
import com.epmet.dto.form.CodeAuditRecordFormDTO;
import com.epmet.dto.form.MessagePushTextFormDTO;
import com.epmet.dto.result.AuthorizationInfoResultDTO;
import com.epmet.dto.result.CustomerIdAndClientResultDTO;
import com.epmet.dto.result.TemplateAndAppIdResultDTO;
import com.epmet.mpaes.AesException;
import com.epmet.mpaes.WXBizMsgCrypt;
import com.epmet.mpaes.WXXmlToMapUtil;
import com.epmet.redis.RedisThird;
import com.epmet.service.WarrantService;
import com.epmet.wxapi.constant.WxMaCodeConstant;
import com.fasterxml.jackson.core.JsonEncoding;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.DocumentException;
@ -26,6 +37,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
@ -56,6 +68,8 @@ public class WarrantServiceImpl implements WarrantService {
private ComponentVerifyTicketServiceImpl componentVerifyTicketServiceImpl;
@Autowired
private MessagePushTextDao messagePushTextDao;
@Autowired
private RedisThird redisThird;
/**
* @Description 1.保存代码审核结果 2.更新代码上传结果
@ -134,8 +148,140 @@ public class WarrantServiceImpl implements WarrantService {
Date date = componentVerifyTicketServiceImpl.sToDate(createTime.toString());
messagePushTextFormDTO.setWeChatCreateTime(date);
messagePushTextDao.insertMessageText(messagePushTextFormDTO);
// switch (messagePushTextFormDTO.getContent()){
// //测试公众号处理用户消息
// case ModuleConstant.TESTCOMPONENT_MSG_TYPE_TEXT:
//
//
// }
// if (messagePushTextFormDTO.getContent().startsWith(ModuleConstant.QUERY_AUTH_CODE)){
// // 测试公众号使用客服消息接口处理用户消息
// String content = messagePushTextFormDTO.getContent();
// String contentBefore = content.substring(NumConstant.ZERO, content.indexOf(ThirdRedisKeyConstant.COLON));
// //auth_code
// String queryAuthCode = content.substring(contentBefore.length() + NumConstant.ONE, content.length());
//
// }
}
log.info("消息与事件接收URL【代码审核结果】结束......");
return ModuleConstant.SUCCESS;
}
/**
* 方法描述: 类型为enevt的时候拼接
* @param request
* @param response
* @param event
* @param toUserName 发送接收人
* @param fromUserName 发送人
* @author zxc
*/
public void replyEventMessage(HttpServletRequest request, HttpServletResponse response,
String event, String toUserName, String fromUserName)
throws DocumentException, IOException {
String content = event + ModuleConstant.FROM_CALLBACK;
replyTextMessage(request,response,content,toUserName,fromUserName);
}
/**
* 立马回应文本消息并最终触达粉丝
* @param content 文本
* @param toUserName 发送接收人
* @param fromUserName 发送人
* @author zxc
*/
public void processTextMessage(HttpServletRequest request, HttpServletResponse response,
String content,String toUserName, String fromUserName)
throws IOException, DocumentException{
if(ModuleConstant.TESTCOMPONENT_MSG_TYPE_TEXT.equals(content)){
String returnContent = content+ModuleConstant._CALL_BACK;
replyTextMessage(request,response,returnContent,toUserName,fromUserName);
}else if(StringUtils.startsWithIgnoreCase(content, ModuleConstant.QUERY_AUTH_CODE)){
response.getWriter().print("");//需在5秒内返回空串表明暂时不回复,然后再立即使用客服消息接口发送消息回复粉丝
log.info(String.format(ThirdRunTimeInfoConstant.TEXT_MESSAGE_LOG_INFO,content,content.split(ThirdRedisKeyConstant.COLON)[NumConstant.ONE],fromUserName,toUserName));
//接下来客服API再回复一次消息
replyApiTextMessage(content.split(ThirdRedisKeyConstant.COLON)[NumConstant.ONE],toUserName);
}
}
/**
* 方法描述: 直接返回给微信开放平台
* @param request
* @param response
* @param content 文本
* @param toUserName 发送接收人
* @param fromUserName 发送人
* @author zxc
*/
public void replyTextMessage(HttpServletRequest request, HttpServletResponse response,
String content,String toUserName, String fromUserName)
throws DocumentException, IOException {
Long createTime = System.currentTimeMillis() / 1000;
StringBuffer sb = new StringBuffer(512);
sb.append("<xml>");
sb.append("<ToUserName><![CDATA["+toUserName+"]]></ToUserName>");
sb.append("<FromUserName><![CDATA["+fromUserName+"]]></FromUserName>");
sb.append("<CreateTime>"+createTime.toString()+"</CreateTime>");
sb.append("<MsgType><![CDATA[text]]></MsgType>");
sb.append("<Content><![CDATA["+content+"]]></Content>");
sb.append("</xml>");
String replyMsg = sb.toString();
log.info(String.format(ThirdRunTimeInfoConstant.SEND_MESSAGE_XML,replyMsg));
returnJSON(replyMsg,response);
}
/**
* 方法描述: 调用客服回复消息给粉丝
* @param auth_code
* @param fromUserName
* @throws DocumentException
* @throws IOException
* @return void
* @author zxc
*/
public void replyApiTextMessage(String auth_code, String fromUserName) throws DocumentException, IOException {
// 得到微信授权成功的消息后,应该立刻进行处理!!相关信息只会在首次授权的时候推送过来
//第三方平台【component_access_token】
String componentAccessToken = redisThird.getComponentAccessToken();
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId);
jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, auth_code);
String authInfo = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_QUERY_AUTH_URL + componentAccessToken, JSON.toJSONString(jsonObject)).getData();
HashMap<String,Map> hashMap = JSON.parseObject(authInfo, HashMap.class);
Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO);
AuthorizationInfoResultDTO authorizationInfoResultDTO = ConvertUtils.mapToEntity(map, AuthorizationInfoResultDTO.class);
String authorizer_access_token = authorizationInfoResultDTO.getAuthorizer_access_token();
JSONObject json = new JSONObject();
json.put("touser",fromUserName);
json.put("msgtype", "text");
json.put("text", "{\"content\":\""+auth_code+ModuleConstant._FROM_API+"\"}");
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.SEND_MESSAGE_CUSTOM + authorizer_access_token, JSON.toJSONString(json)).getData();
log.info("客服发送接口返回值:"+data);
}
/**
* 方法描述: 返回数据到请求方
* @param data 数据
* @param response
* @author zxc
*/
public void returnJSON(Object data,HttpServletResponse response) {
try {
ObjectMapper objectMapper = new ObjectMapper();
JsonEncoding encoding = JsonEncoding.UTF8;
response.setContentType(ModuleConstant.APPLICATION_JSON);
JsonGenerator generator = objectMapper.getJsonFactory().
createJsonGenerator(response.getOutputStream(), encoding);
objectMapper.writeValue(generator, data);
} catch (IOException e) {
e.printStackTrace();
}
}
}

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java

@ -76,6 +76,11 @@ public interface WxMaCodeConstant {
*/
String API_OPEN_GET = "https://api.weixin.qq.com/cgi-bin/open/get?access_token=";
/**
*
*/
String SEND_MESSAGE_CUSTOM = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=";
/**
* 为授权的小程序帐号上传小程序代码.
*/

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java

@ -204,7 +204,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
public WxResult<byte[]> getMaterial(String accessToken, WxMaNewsReq request) {
WxResult<byte[]> result = new WxResult<>();
String url = WxMaCodeConstant.GET_MATERIAL_URL + "?" + "access_token=" + accessToken;
Result<byte[]> statusResult = HttpClientManager.getInstance().getByteArray(url, toMap(request));
Result<byte[]> statusResult = HttpClientManager.getInstance().getMediaByteArray(url, toJson(request));
if (!statusResult.success()) {
result.setErrorCode(statusResult.getCode());
result.setErrorMsg(statusResult.getMsg());

13
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.4__thirdUpdate.sql

@ -0,0 +1,13 @@
CREATE TABLE `fixation_app_id` (
`ID` varchar(64) NOT NULL COMMENT 'ID',
`APP_ID` varchar(64) DEFAULT NULL COMMENT '小程序AppId',
`CUSTOMER_ID` varchar(64) DEFAULT NULL COMMENT '客户Id',
`CLIENT_TYPE` varchar(32) DEFAULT NULL COMMENT '客户端类型resi:居民端,work:工作端',
`DEL_FLAG` int(11) DEFAULT NULL COMMENT '删除状态0:正常,已删除',
`REVISION` int(11) DEFAULT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人',
`CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人',
`UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='固定的AppId表 ';

8
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml

@ -145,4 +145,12 @@
AND client = #{clientType}
</select>
<update id="updateCustomerId">
UPDATE customer_mp
SET customer_id = #{newCustonerId}
WHERE
del_flag = '0'
AND customer_id = #{oldCustomerId}
</update>
</mapper>

17
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/FixationAppIdDao.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.FixationAppIdDao">
<!-- 查询固定AppId信息 -->
<select id="selectFixationInfos" resultType="com.epmet.dto.result.FixationAppIdResultDTO">
SELECT
customer_id AS masterCustomerId,
client_type AS clientType,
app_id AS appId
FROM
fixation_app_id
WHERE
del_flag = 0
</select>
</mapper>

8
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml

@ -82,4 +82,12 @@
LIMIT 1
</select>
<update id="updateCustomerId">
UPDATE pa_customer_agency
SET customer_id = #{newCustonerId}
WHERE
del_flag = '0'
AND customer_id = #{oldCustomerId}
</update>
</mapper>

8
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml

@ -79,4 +79,12 @@
AND id = #{id}
</update>
<update id="updateIdById">
UPDATE pa_customer
SET id = #{newCustonerId}
WHERE
del_flag = '0'
AND id = #{oldCustomerId}
</update>
</mapper>

8
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml

@ -34,4 +34,12 @@
AND pcua.user_id = #{userId}
</select>
<update id="updateCustomerId">
UPDATE pa_customer_user_agency
SET customer_id = #{newCustonerId}
WHERE
del_flag = '0'
AND customer_id = #{oldCustomerId}
</update>
</mapper>

16
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml

@ -50,4 +50,20 @@
AND source = #{source}
</select>
<!-- 查询管理员基本信息 -->
<select id="selectManagerInfo" resultType="com.epmet.dto.form.CustomerManagerFormDTO">
SELECT
pu.real_name AS realName,
pu.gender AS gender,
pu.phone AS mobile
FROM
pa_user pu
LEFT JOIN customer_mp cm ON cm.created_by = pu.id
WHERE
pu.del_flag = '0'
AND cm.CUSTOMER_ID = #{customerId}
AND CM.DEL_FLAG = '0'
LIMIT 1
</select>
</mapper>

2
epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
gov-access-server:
container_name: gov-access-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.37
image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.38
ports:
- "8099:8099"
network_mode: host # 使用现有网络

2
epmet-module/gov-access/gov-access-server/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"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<version>0.3.37</version>
<version>0.3.38</version>
<parent>
<artifactId>gov-access</artifactId>
<groupId>com.epmet</groupId>

12
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java

@ -5,9 +5,11 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAppDTO;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.CustomerAppSecretFormDTO;
import com.epmet.dto.form.CustomerManagerFormDTO;
import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@ -41,4 +43,14 @@ public interface OperCrmOpenFeignClient {
*/
@PostMapping("/oper/crm/customerapp/getconfigallapp")
Result<List<CustomerAppDTO>> getConfigAllApp();
/**
* 添加根管理员
* @author zhaoqifeng
* @date 2020/8/3 15:24
* @param form
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/oper/crm/customer/addmanager")
Result addManager(@RequestBody CustomerManagerFormDTO form);
}

6
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java

@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAppDTO;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.CustomerAppSecretFormDTO;
import com.epmet.dto.form.CustomerManagerFormDTO;
import com.epmet.feign.OperCrmOpenFeignClient;
import org.springframework.stereotype.Component;
@ -39,4 +40,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient {
public Result<List<CustomerAppDTO>> getConfigAllApp() {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getConfigAllApp", null);
}
@Override
public Result addManager(CustomerManagerFormDTO form) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "CustomerManagerFormDTO", form);
}
}

2
epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
oper-crm-server:
container_name: oper-crm-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.58
image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.59
ports:
- "8090:8090"
network_mode: host # 使用现有网络

2
epmet-module/oper-crm/oper-crm-server/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"
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>
<version>0.3.58</version>
<version>0.3.59</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>oper-crm</artifactId>

13
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

@ -278,6 +278,19 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
throw new RenException("没有查询到客户根级组织,无法设置管理员:".concat(getRoleResult.toString()));
}
StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO();
staffRoleFormDTO.setOrgId(customerRootAgencyResult.getData().getId());
staffRoleFormDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER);
Result<List<GovStaffRoleResultDTO>> managersResult = epmetUserFeignClient.getStaffsInRole(staffRoleFormDTO);
if(!managersResult.success()) {
log.error("查询客户根级组织的管理员失败".concat(getRoleResult.toString()));
throw new RenException("查询客户根级组织的管理员失败".concat(getRoleResult.toString()));
}
if(null != managersResult.getData() && managersResult.getData().size() > NumConstant.ZERO) {
log.error("客户已存在管理员".concat(getRoleResult.toString()));
throw new RenException("客户已存在管理员".concat(getRoleResult.toString()));
}
StaffSubmitFromDTO staffSubmitFrom = new StaffSubmitFromDTO();
staffSubmitFrom.setCustomerId(form.getCustomerId());
staffSubmitFrom.setAgencyId(customerRootAgencyResult.getData().getId());

2
epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
resi-mine-server:
container_name: resi-mine-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.33
image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.35
ports:
- "8094:8094"
network_mode: host # 使用现有网络

8
epmet-module/resi-mine/resi-mine-server/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"
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>
<version>0.3.33</version>
<version>0.3.35</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>resi-mine</artifactId>
@ -90,6 +90,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

22
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java

@ -3,14 +3,13 @@ package com.epmet.modules.grid.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.modules.grid.service.ResiMineGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -48,4 +47,19 @@ public class ResiMineGridController {
public Result<List<AllGridsByUserIdResultDTO>> allGrids(@LoginUser TokenDto tokenDto){
return resiMineGridService.allGrids(tokenDto.getUserId());
}
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-获取用户最近访问网格
* @Date 2020/8/3
**/
@PostMapping("latestgridinfo")
public Result<LatestGridInfoResultDTO> latestGridInfo(@LoginUser TokenDto token, @RequestBody LatestGridInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
formDTO.setUserId(token.getUserId());
return new Result<LatestGridInfoResultDTO>().ok(resiMineGridService.latestGridInfo(formDTO));
}
}

10
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java

@ -2,6 +2,7 @@ package com.epmet.modules.grid.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
@ -29,4 +30,13 @@ public interface ResiMineGridService {
* @Author sun
**/
Result<List<AllGridsByUserIdResultDTO>> allGrids(String userId);
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-获取用户最近访问网格
* @Date 2020/8/3
**/
LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO);
}

47
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java

@ -1,13 +1,19 @@
package com.epmet.modules.grid.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
import com.epmet.modules.grid.service.ResiMineGridService;
@ -20,6 +26,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Description 居民端用户网格信息service
@ -33,6 +40,8 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
/**
* @param tokenDto
@ -88,4 +97,42 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
}
return result.ok(resultGrids.getData());
}
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-获取用户最近访问网格
* @Date 2020/8/3
**/
@Override
public LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO) {
logger.info(String.format("居民端获取用户最近访问网格入参%s", JSON.toJSONString(formDTO)));
//1.调用third服务,根据appId获取客户Id
JSONObject jsonObject = new JSONObject();
String customerMsgUrl = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/";
String data = HttpClientManager.getInstance().sendPostByJSON(customerMsgUrl + formDTO.getAppId(), JSON.toJSONString(jsonObject)).getData();
logger.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data);
JSONObject toResult = JSON.parseObject(data);
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class);
if (!mapToResult.success()) {
logger.error(String.format("根据appId查询客户信息失败,对应appId->" + formDTO.getAppId()));
throw new RenException(mapToResult.getMsg());
}
Object PublicCustomerResultDTO = mapToResult.getData();
JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString());
Map<String, Object> map = (Map) json.get("customer");
PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class);
logger.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->" + customer);
//2.调用epmet-user服务,根据客户Id和用户Id查询最后一次访问记录
formDTO.setCustomerId(customer.getId());
Result<LatestGridInfoResultDTO> userResult = epmetUserOpenFeignClient.latestGridInfo(formDTO);
if (!userResult.success()) {
logger.error(String.format("居民端获取用户最近访问网格失败,接口入参客户Id->%s,appId->%s,调用epmet-user-server服务返回->%s", formDTO.getCustomerId(), formDTO.getAppId(), JSON.toJSONString(userResult)));
}
return userResult.getData();
}
}

38
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/LatestGridInfoFormDTO.java

@ -0,0 +1,38 @@
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 单客户-获取用户最近访问网格-接口入参
* @Auth sun
*/
@Data
public class LatestGridInfoFormDTO implements Serializable {
private static final long serialVersionUID = -6534841370041338474L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
/**
* 小程序绑定的appId
*/
@NotBlank(message = "数据来源不能为空", groups = {LatestGridInfoFormDTO.AddUserInternalGroup.class, LatestGridInfoFormDTO.AddUserShowGroup.class})
private String appId;
/**
* 根据appId查询到的客户Id
*/
private String customerId;
/**
* token中userId
*/
private String userId;
}

10
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -249,4 +249,14 @@ public interface EpmetUserOpenFeignClient {
**/
@PostMapping("/epmetuser/userbaseinfo/volunteerbaseinfo")
Result volunteerBaseInfo(@RequestBody ResiVolunteerAuthenticateFormDTO param);
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-获取用户最近访问网格
* @Date 2020/8/3
**/
@PostMapping(value = "epmetuser/gridlatest/latestgridinfo")
Result<LatestGridInfoResultDTO> latestGridInfo(@RequestBody LatestGridInfoFormDTO formDTO);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -178,4 +178,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result volunteerBaseInfo(ResiVolunteerAuthenticateFormDTO param) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "volunteerBaseInfo", param);
}
@Override
public Result<LatestGridInfoResultDTO> latestGridInfo(LatestGridInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "latestGridInfo", formDTO);
}
}

2
epmet-user/epmet-user-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-user-server:
container_name: epmet-user-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.102
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.104
ports:
- "8087:8087"
network_mode: host # 不会创建新的网络

2
epmet-user/epmet-user-server/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"
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>
<version>0.3.102</version>
<version>0.3.104</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-user</artifactId>

13
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.GridLatestDTO;
import com.epmet.dto.form.CustomerUserFormDTO;
import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.result.CustomerUser4PointResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.excel.GridLatestExcel;
@ -130,4 +131,16 @@ public class GridLatestController {
return new Result<List<CustomerUser4PointResultDTO>>().ok(gridLatestService.getCustomerUsers(param));
}
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-根据客户Id和userId查询用户最后一次访问的网格
* @Date 2020/8/3
**/
@PostMapping("latestgridinfo")
public Result<LatestGridInfoResultDTO> latestGridInfo(@RequestBody LatestGridInfoFormDTO formDTO){
return new Result<LatestGridInfoResultDTO>().ok(gridLatestService.latestGridInfo(formDTO));
}
}

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

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GridLatestDTO;
import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.entity.GridLatestEntity;
import org.apache.ibatis.annotations.Mapper;
@ -64,4 +65,13 @@ public interface GridLatestDao extends BaseDao<GridLatestEntity> {
* @date 2020.07.25 15:26
**/
List<String> selectAllUserByCustomerId(@Param("customerId")String customerId);
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-根据客户Id和userId查询用户最后一次访问的网格
* @Date 2020/8/3
**/
LatestGridInfoResultDTO selectLatestGridInfo(LatestGridInfoFormDTO formDTO);
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java

@ -58,9 +58,9 @@ public interface UserRoleDao extends BaseDao<UserRoleEntity> {
* 根据用户ID查询用户所属角色: 多种身份
*
* @param userId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.UserRoleResultDTO>>
* @return java.util.List<com.epmet.dto.result.UserRoleResultDTO>
* @Author zhangyong
* @Date 14:24 2020-07-23
**/
Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(@Param("userId") String userId);
List<UserRoleResultDTO> getUserRoleInfoByUserId(@Param("userId") String userId);
}

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

@ -23,6 +23,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.GridLatestDTO;
import com.epmet.dto.form.CustomerUserFormDTO;
import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.form.VisitedFormDTO;
import com.epmet.dto.result.CustomerUser4PointResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
@ -131,4 +132,12 @@ public interface GridLatestService extends BaseService<GridLatestEntity> {
**/
List<CustomerUser4PointResultDTO> getCustomerUsers(CustomerUserFormDTO customerUserFormDTO);
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-根据客户Id和userId查询用户最后一次访问的网格
* @Date 2020/8/3
**/
LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO);
}

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

@ -30,6 +30,7 @@ import com.epmet.dao.UserWechatDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.GridLatestDTO;
import com.epmet.dto.form.CustomerUserFormDTO;
import com.epmet.dto.form.LatestGridInfoFormDTO;
import com.epmet.dto.form.VisitedFormDTO;
import com.epmet.dto.result.CustomerUser4PointResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO;
@ -204,4 +205,17 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
return allData;
}
/**
* @return
* @param formDTO
* @Author sun
* @Description 单客户-根据客户Id和userId查询用户最后一次访问的网格
* @Date 2020/8/3
**/
@Override
public LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO) {
return baseDao.selectLatestGridInfo(formDTO);
}
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java

@ -134,7 +134,8 @@ public class UserRoleServiceImpl extends BaseServiceImpl<UserRoleDao, UserRoleEn
@Override
public Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(String userId) {
return baseDao.getUserRoleInfoByUserId(userId);
List<UserRoleResultDTO> list = baseDao.getUserRoleInfoByUserId(userId);
return new Result<List<UserRoleResultDTO>>().ok(list);
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java

@ -192,7 +192,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
Result<ResiPointDetailResultDTO> pointResult = epmetPointOpenFeignClient.myPoint(dto);
if(pointResult.success() && null != pointResult.getData()){
//累计积分
result.setPoint(pointResult.getData().getAccumulatedPoint());
result.setPoint(pointResult.getData().getUsablePoint());
}
return result;
}

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

@ -93,4 +93,19 @@
del_flag = '0'
AND customer_id = #{customerId}
</select>
<select id="selectLatestGridInfo" resultType="com.epmet.dto.result.LatestGridInfoResultDTO">
SELECT
gl.GRID_ID,
gl.CUSTOMER_ID
FROM
grid_latest gl
WHERE
gl.DEL_FLAG = '0'
AND gl.CUSTOMER_ID = #{customerId}
AND gl.CUSTOMER_USER_ID = #{userId}
ORDER BY
gl.LATEST_TIME DESC
LIMIT 1
</select>
</mapper>

Loading…
Cancel
Save