Browse Source

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

master
wxz 5 years ago
parent
commit
c9828fa03b
  1. 2
      epmet-auth/deploy/docker-compose-dev.yml
  2. 2
      epmet-auth/deploy/docker-compose-test.yml
  3. 2
      epmet-auth/pom.xml
  4. 31
      epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java
  5. 48
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgsFormDTO.java
  6. 20
      epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java
  7. 189
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  8. 9
      epmet-commons/epmet-commons-tools/pom.xml
  9. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  10. 80
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java
  11. 23
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  12. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActCaculateDistanceFormDTO.java
  13. 16
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java
  14. 19
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java
  15. 46
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActAddressResultDTO.java
  16. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java
  17. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java
  18. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java
  19. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java
  20. 4
      epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml
  21. 2
      epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-prod.yml
  22. 2
      epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-test.yml
  23. 2
      epmet-module/epmet-heart/epmet-heart-server/pom.xml
  24. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  25. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java
  26. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java
  27. 17
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  28. 78
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  29. 79
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java
  30. 101
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  31. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java
  32. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  33. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java
  34. 29
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  35. 37
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
  36. 94
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java
  37. 423
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql
  38. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  39. 2
      epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml
  40. 2
      epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-test.yml
  41. 2
      epmet-module/epmet-oss/epmet-oss-server/pom.xml
  42. 106
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java
  43. 10
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java
  44. 29
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java
  45. 56
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointAdjustmentFormDTO.java
  46. 53
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java
  47. 4
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiCommonUserIdFormDTO.java
  48. 20
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiPointRankFormDTO.java
  49. 32
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java
  50. 36
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointAdjustmentResultDTO.java
  51. 2
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java
  52. 1
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java
  53. 36
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointVerificationResultDTO.java
  54. 2
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiPointRankListResultDTO.java
  55. 27
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerficationListResultDTO.java
  56. 33
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationDetailResultDTO.java
  57. 38
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationLogResultDTO.java
  58. 15
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java
  59. 9
      epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java
  60. 4
      epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml
  61. 2
      epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-prod.yml
  62. 2
      epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-test.yml
  63. 2
      epmet-module/epmet-point/epmet-point-server/pom.xml
  64. 59
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/AdjustmentController.java
  65. 2
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java
  66. 122
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java
  67. 46
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdjustmentLogDao.java
  68. 12
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java
  69. 11
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationStatisticalDailyDao.java
  70. 8
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java
  71. 9
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointTotalDao.java
  72. 76
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java
  73. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java
  74. 18
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/redis/PointRedis.java
  75. 126
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdjustmentLogService.java
  76. 28
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationLogService.java
  77. 9
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationStatisticalDailyService.java
  78. 7
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java
  79. 11
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java
  80. 31
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java
  81. 242
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java
  82. 3
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java
  83. 256
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationLogServiceImpl.java
  84. 18
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationStatisticalDailyServiceImpl.java
  85. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  86. 113
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java
  87. 137
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java
  88. 91
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/DimIdGenerator.java
  89. 55
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/ModuleConstant.java
  90. 43
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml
  91. 20
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationLogDao.xml
  92. 14
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationStatisticalDailyDao.xml
  93. 20
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointStatisticalDailyDao.xml
  94. 15
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml
  95. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml
  96. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml
  97. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  98. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java
  99. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java
  100. 89
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java

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

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

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

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

2
epmet-auth/pom.xml

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

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

@ -3,7 +3,10 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.LoginFormDTO;
import com.epmet.dto.form.StaffOrgsFormDTO;
import com.epmet.dto.form.ThirdStaffOrgsFormDTO;
import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.ThirdLoginService;
import org.springframework.beans.factory.annotation.Autowired;
@ -12,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description 第三方-居民端政府端登陆服务
* @author sun
@ -60,4 +65,30 @@ public class ThirdLoginController {
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 单客户-手机验证码获取组织
**/
@PostMapping(value = "/getmyorg")
public Result<List<StaffOrgsResultDTO>> getmyorg(@RequestBody ThirdStaffOrgsFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffOrgsFormDTO.AddUserShowGroup.class, StaffOrgsFormDTO.GetMyOrgByLoginWxmp.class);
List<StaffOrgsResultDTO> staffOrgs = thirdLoginService.getMyOrg(formDTO);
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}
/**
* @param formDTO
* @return
* @author sun
* @description 单客户-手机号密码获取组织
**/
@PostMapping(value = "/getmyorgbypassword")
public Result<List<StaffOrgsResultDTO>> getMyOrgByPassword(@RequestBody ThirdStaffOrgsFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffOrgsFormDTO.AddUserShowGroup.class, StaffOrgsFormDTO.GetMyOrgByPassWordGroup.class);
List<StaffOrgsResultDTO> staffOrgs = thirdLoginService.getMyOrgByPassword(formDTO);
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}
}

48
epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgsFormDTO.java

@ -0,0 +1,48 @@
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 appId手机号验证码获取组织-接口入参
* @Author sun
*/
@Data
public class ThirdStaffOrgsFormDTO implements Serializable {
private static final long serialVersionUID = 4193133227120225342L;
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
public interface GetMyOrgByPassWordGroup extends CustomerClientShowGroup {
}
public interface GetMyOrgByLoginWxmp extends CustomerClientShowGroup{}
/**
* 小程序appId
*/
@NotBlank(message = "appId不能为空", groups = {AddUserShowGroup.class})
private String appId;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class})
private String mobile;
/**
* 验证码
*/
@NotBlank(message="验证码不能为空", groups = {GetMyOrgByLoginWxmp.class})
private String smsCode;
@NotBlank(message = "密码不能为空",groups ={GetMyOrgByPassWordGroup.class})
private String password;
}

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

@ -1,9 +1,13 @@
package com.epmet.service;
import com.epmet.dto.form.LoginFormDTO;
import com.epmet.dto.form.ThirdStaffOrgsFormDTO;
import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import java.util.List;
/**
* @Description 第三方-居民端政府端登陆服务
* @author sun
@ -33,4 +37,20 @@ public interface ThirdLoginService {
* @Description 单客户-选择组织进入首页
**/
UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 单客户-手机验证码获取组织
**/
List<StaffOrgsResultDTO> getMyOrg(ThirdStaffOrgsFormDTO formDTO);
/**
* @param formDTO
* @return
* @author sun
* @description 单客户-手机号密码获取组织
**/
List<StaffOrgsResultDTO> getMyOrgByPassword(ThirdStaffOrgsFormDTO formDTO);
}

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

@ -2,38 +2,36 @@ package com.epmet.service.impl;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.DepartmentListResultDTO;
import com.epmet.dto.result.GridByStaffResultDTO;
import com.epmet.dto.result.StaffLatestAgencyResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetThirdFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.CaptchaRedis;
import com.epmet.service.ThirdLoginService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -48,6 +46,8 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private CaptchaRedis captchaRedis;
@Autowired
private JwtTokenProperties jwtTokenProperties;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@ -142,6 +142,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
**/
@Override
public UserTokenResultDTO workLogin(LoginFormDTO formDTO) {
//1.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO();
resiLoginFormDTO.setAppId(formDTO.getAppId());
@ -379,66 +380,150 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey());
wxMaJscode2SessionResult.setUnionid("");
// end
//3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
this.savestaffwechat(customerStaff.getUserId(), userWechatDTO.getWxOpenId());
//4、记录登录日志
this.saveGovStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = new StaffLatestAgencyResultDTO();
staffLatestAgencyResultDTO.setCustomerId(formDTO.getCustomerId());
staffLatestAgencyResultDTO.setStaffId(customerStaff.getUserId());
staffLatestAgencyResultDTO.setWxOpenId(userWechatDTO.getWxOpenId());
staffLatestAgencyResultDTO.setMobile(formDTO.getMobile());
staffLatestAgencyResultDTO.setAgencyId(formDTO.getRootAgencyId());
this.saveStaffLoginRecord(staffLatestAgencyResultDTO);
//5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//5.2、保存到redis
this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
StaffLatestAgencyResultDTO staffLatestAgency = new StaffLatestAgencyResultDTO();
staffLatestAgency.setAgencyId(formDTO.getRootAgencyId());
staffLatestAgency.setCustomerId(formDTO.getCustomerId());
staffLatestAgency.setStaffId(customerStaff.getUserId());
this.saveLatestGovTokenDto(staffLatestAgency, userWechatDTO, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
//保存登录日志
private Result saveGovStaffLoginRecord(ThirdWxmpEnteOrgFormDTO formDTO, String staffId, String openId) {
StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO();
staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId());
staffLoginAgencyRecordFormDTO.setStaffId(staffId);
staffLoginAgencyRecordFormDTO.setWxOpenId(openId);
staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile());
staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getRootAgencyId());
Result staffLoginRecordResult = epmetUserOpenFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO);
return staffLoginRecordResult;
/**
* @param formDTO
* @return
* @Author sun
* @Description 单客户-手机验证码获取组织
**/
@Override
public List<StaffOrgsResultDTO> getMyOrg(ThirdStaffOrgsFormDTO formDTO) {
//0、验证码是否正确
String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile());
if (!formDTO.getSmsCode().equals(rightSmsCode)) {
logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//1.根据appId查询对应客户Id
Result<PublicCustomerResultDTO> resultDTO = epmetThirdFeignClient.getCustomerMsg(formDTO.getAppId());
if (!resultDTO.success()) {
logger.error(String.format("根据appId查询客户Id失败,对应appId->" + formDTO.getAppId()));
throw new RenException(resultDTO.getMsg());
}
PaCustomerDTO customer = resultDTO.getData().getCustomer();
//7.28 根据appId只能存在一个客户Id,后边的批量操作逻辑
//2.根据手机号查询到用户信息
ThirdCustomerStaffFormDTO dto = new ThirdCustomerStaffFormDTO();
dto.setCustomerId(customer.getId());
dto.setMobile(formDTO.getMobile());
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndPhone(dto);
if (!customerStaffResult.success()) {
logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//3、查询用户所有的组织信息
List<String> customerIdList = new ArrayList<>();
for (CustomerStaffDTO customerStaffDTO : customerStaffResult.getData()) {
customerIdList.add(customerStaffDTO.getCustomerId());
}
StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();
staffOrgFormDTO.setCustomerIdList(customerIdList);
Result<List<StaffOrgsResultDTO>> result = govOrgOpenFeignClient.getStaffOrgList(staffOrgFormDTO);
if(result.success()&&null!=result.getData()){
return result.getData();
}
logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,验证码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER,formDTO.getMobile(),formDTO.getSmsCode(),result.getCode(),result.getMsg()));
return new ArrayList<>();
}
/**
* @Description 生成token
* @Date 2020/4/18 23:04
* @param formDTO
* @return
* @author sun
* @description 单客户-手机号密码获取组织
**/
private void saveGovTokenDto(String orgId,
String customerId,
String staffId,
WxMaJscode2SessionResult wxMaJscode2SessionResult,
String token) {
int expire = jwtTokenProperties.getExpire();
GovTokenDto govTokenDto = new GovTokenDto();
govTokenDto.setApp(LoginConstant.APP_GOV);
govTokenDto.setClient(LoginConstant.CLIENT_WXMP);
govTokenDto.setUserId(staffId);
govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid());
govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey());
govTokenDto.setUnionId(null == wxMaJscode2SessionResult.getUnionid() ? "" : wxMaJscode2SessionResult.getUnionid());
govTokenDto.setToken(token);
govTokenDto.setUpdateTime(System.currentTimeMillis());
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
govTokenDto.setRootAgencyId(orgId);
govTokenDto.setCustomerId(customerId);
@Override
public List<StaffOrgsResultDTO> getMyOrgByPassword(ThirdStaffOrgsFormDTO formDTO) {
//0.根据appId查询对应客户Id
Result<PublicCustomerResultDTO> resultDTO = epmetThirdFeignClient.getCustomerMsg(formDTO.getAppId());
if (!resultDTO.success()) {
logger.error(String.format("根据appId查询客户Id失败,对应appId->" + formDTO.getAppId()));
throw new RenException(resultDTO.getMsg());
}
PaCustomerDTO customer = resultDTO.getData().getCustomer();
//7.28 上边根据appId只能锁定一条客户id,后边的批量循环操作暂不做调整,还是使用之前的代码 sun
//1、根据手机号查询到用户信息
ThirdCustomerStaffFormDTO dto = new ThirdCustomerStaffFormDTO();
dto.setCustomerId(customer.getId());
dto.setMobile(formDTO.getMobile());
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndPhone(dto);
if (!customerStaffResult.success()) {
logger.error(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//2、密码是否正确
List<CustomerStaffDTO> customerStaffList=customerStaffResult.getData();
//3、查询用户所有的组织信息
List<String> customerIdList = new ArrayList<>();
//是否设置过密码
boolean havePasswordFlag=false;
//密码是否正确
boolean passwordRightFlag=false;
for (CustomerStaffDTO customerStaffDTO : customerStaffList) {
if(StringUtils.isNotBlank(customerStaffDTO.getPassword())){
havePasswordFlag=true;
}else{
logger.warn(String.format("当前用户:手机号%s,客户Id%s下未设置密码.",formDTO.getMobile(),customerStaffDTO.getCustomerId()));
continue;
}
if (!PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) {
logger.warn(String.format("当前用户:手机号%s,客户Id%s密码匹配错误.",formDTO.getMobile(),customerStaffDTO.getCustomerId()));
//设置部门,网格,角色列表
govTokenDto.setDeptIdList(getDeptartmentIdList(staffId));
govTokenDto.setGridIdList(getGridIdList(staffId));
CustomerAgencyDTO agency = getAgencyByStaffId(staffId);
if (agency != null) {
govTokenDto.setAgencyId(agency.getId());
govTokenDto.setRoleList(queryGovStaffRoles(staffId, agency.getId()));
}else{
logger.warn(String.format("当前用户:手机号%s,客户Id%s密码匹配正确.",formDTO.getMobile(),customerStaffDTO.getCustomerId()));
passwordRightFlag=true;
customerIdList.add(customerStaffDTO.getCustomerId());
}
}
govTokenDto.setOrgIdPath(getOrgIdPath(staffId));
cpUserDetailRedis.set(govTokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
//根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码
if(!havePasswordFlag){
logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
//密码错误
if(!passwordRightFlag){
logger.error(String.format("根据当前手机号(%s)密码未找到所属组织,密码错误",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();
staffOrgFormDTO.setCustomerIdList(customerIdList);
Result<List<StaffOrgsResultDTO>> result = govOrgOpenFeignClient.getStaffOrgList(staffOrgFormDTO);
if(result.success()&&null!=result.getData()){
return result.getData();
}
logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s",
ServiceConstant.GOV_ORG_SERVER,
formDTO.getMobile(),
formDTO.getPassword(),
result.getCode(),
result.getMsg()));
return new ArrayList<>();
}
}

9
epmet-commons/epmet-commons-tools/pom.xml

@ -133,6 +133,15 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<build>

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

@ -84,7 +84,7 @@ public enum EpmetErrorCode {
// 爱心互助 居民端
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),
NON_CERTIFIED_VOLUNTEER(8511, "活动报名失败,请先认证志愿者"),
ACT_TIME_CONFLICT(8512, "活动时间冲突"),
ACT_TIME_CONFLICT(8512, "报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),

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

@ -1,37 +1,65 @@
package com.epmet.commons.tools.utils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
/**
* @author kamui
*/
public class FileUtils {
/**
* 创建临时文件.
*
* @param inputStream 输入文件流
* @param name 文件名
* @param ext 扩展名
* @param tmpDirFile 临时文件夹目录
*/
public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException {
File resultFile = File.createTempFile(name, '.' + ext, tmpDirFile);
resultFile.deleteOnExit();
org.apache.commons.io.FileUtils.copyToFile(inputStream, resultFile);
return resultFile;
}
/**
* 创建临时文件.
*
* @param inputStream 输入文件流
* @param name 文件名
* @param ext 扩展名
*/
public static File createTmpFile(InputStream inputStream, String name, String ext) throws IOException {
return createTmpFile(inputStream, name, ext, Files.createTempDirectory("weixin-java-tools-temp").toFile());
}
/**
* 创建临时文件
*
* @param inputStream
* @param name 文件名
* @param ext 扩展名
* @param tmpDirFile 临时文件夹目录
*/
public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException {
File tmpFile;
if (tmpDirFile == null) {
tmpFile = File.createTempFile(name, '.' + ext);
} else {
tmpFile = File.createTempFile(name, '.' + ext, tmpDirFile);
}
tmpFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(tmpFile);
try {
int read = 0;
byte[] bytes = new byte[1024 * 100];
while ((read = inputStream.read(bytes)) != -1) {
fos.write(bytes, 0, read);
}
fos.flush();
} catch (Exception e) {
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
}
}
}
return tmpFile;
}
/**
* 创建临时文件
*
* @param inputStream
* @param name 文件名
* @param ext 扩展名
*/
public static File createTmpFile(InputStream inputStream, String name, String ext) throws IOException {
return createTmpFile(inputStream, name, ext, null);
}
}

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

@ -22,7 +22,6 @@ import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
@ -171,20 +170,14 @@ public class HttpClientManager {
try {
HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig);
String boundaryStr = "------------" + System.currentTimeMillis();
httppost.addHeader("Connection", "keep-alive");
httppost.addHeader("Accept", "*/*");
httppost.addHeader("Content-Type", "multipart/form-data;boundary=" + boundaryStr);
httppost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
MultipartEntityBuilder meb = MultipartEntityBuilder.create();
meb.setBoundary(boundaryStr).setCharset(StandardCharsets.UTF_8).setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
meb.addBinaryBody("media", file, ContentType.APPLICATION_OCTET_STREAM, file.getName());
HttpEntity entity = meb.build();
httppost.setEntity(entity);
// FileBody fileBody = new FileBody(file);
// HttpEntity reqEntity = MultipartEntityBuilder.create()
// .addPart("media", fileBody).build();
// httppost.setEntity(reqEntity);
if (file != null) {
HttpEntity entity = MultipartEntityBuilder
.create()
.addBinaryBody("media", file)
.setMode(HttpMultipartMode.RFC6532)
.build();
httppost.setEntity(entity);
}
return execute(httppost,false);
} catch (Exception e) {
log.error("send exception", e);

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

@ -3,6 +3,7 @@ package com.epmet.dto.form.resi;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -28,13 +29,13 @@ public class ResiActCaculateDistanceFormDTO implements Serializable {
/**
* 经度
*/
@NotBlank(message = "经度不能为空", groups = { AddUserInternalGroup.class })
@NotNull(message = "经度不能为空", groups = { AddUserInternalGroup.class })
private Double longitude;
/**
* 纬度
*/
@NotBlank(message = "纬度不能为空", groups = { AddUserInternalGroup.class })
@NotNull(message = "纬度不能为空", groups = { AddUserInternalGroup.class })
private Double latitude;
/**

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

@ -21,6 +21,7 @@ import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@ -43,13 +44,6 @@ public class ResiActInsertLiveFormDTO implements Serializable {
*/
public interface AddUserInternalGroup {}
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
@ -66,19 +60,19 @@ public class ResiActInsertLiveFormDTO implements Serializable {
/**
* 活动签到位置经度
*/
@NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
@NotNull(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal longitude;
/**
* 活动签到位置纬度
*/
@NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
@NotNull(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal latitude;
/**
* 活动签到地址
*/
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class})
private String address;
/**
@ -99,6 +93,6 @@ public class ResiActInsertLiveFormDTO implements Serializable {
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class })
@NotBlank(message = "客户id不能为空", groups = {AddUserInternalGroup.class })
private String customerId;
}

19
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java

@ -20,7 +20,9 @@ package com.epmet.dto.form.resi;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@ -43,13 +45,6 @@ public class ResiActSignInFormDTO implements Serializable {
*/
public interface AddUserInternalGroup {}
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {}
// <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<<
/**
@ -66,19 +61,19 @@ public class ResiActSignInFormDTO implements Serializable {
/**
* 活动签到位置经度
*/
@NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
@NotNull(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal longitude;
/**
* 活动签到位置纬度
*/
@NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
@NotNull(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class })
private BigDecimal latitude;
/**
* 活动签到地址
*/
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
@NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class})
private String address;
/**
@ -89,7 +84,7 @@ public class ResiActSignInFormDTO implements Serializable {
/**
* 0不同步实况1同步到实况记录
*/
@NotBlank(message = "是否同步到实况记录不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class})
@Min(0)
private Integer syncLive;
/**
@ -100,6 +95,6 @@ public class ResiActSignInFormDTO implements Serializable {
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class })
@NotBlank(message = "客户id不能为空", groups = {AddUserInternalGroup.class })
private String customerId;
}

46
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActAddressResultDTO.java

@ -0,0 +1,46 @@
/**
* 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.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 是否到达活动打卡地址
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Data
public class ResiActAddressResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Boolean isAddress;
/**
* 未报到活动范围的提示信息
*/
private String errorTip;
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java

@ -52,4 +52,9 @@ public class CanceledActResultDTO implements Serializable {
* 活动取消的原因
*/
private String cancelReason;
/**
* 活动地点
*/
private String actAddress;
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java

@ -53,4 +53,9 @@ public class FinishedActResultDTO implements Serializable {
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date actualEndTime;
/**
* 活动地点
*/
private String actAddress;
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java

@ -77,4 +77,9 @@ public class InProgressActResultDTO implements Serializable {
@JsonIgnore
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private Date signUpStartTime;
/**
* 活动地点
*/
private String actAddress;
}

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java

@ -51,6 +51,12 @@ public class JoinedUserResultDTO implements Serializable {
*/
private Boolean signInFlag;
/**
* 已签到:signed_in; 默认""
*/
@JsonIgnore
private String signInFlagStr;
/**
* true: 是志愿者 false : 不是志愿者
*/

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

@ -1,8 +1,8 @@
version: "3.7"
services:
oper-crm-server:
epmet-heart-server:
container_name: epmet-heart-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.2
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-heart-server:0.0.5
ports:
- "8111:8111"
network_mode: host # 使用现有网络

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

@ -1,6 +1,6 @@
version: "3.7"
services:
oper-crm-server:
epmet-heart-server:
container_name: epmet-heart-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-heart-server:0.0.1
ports:

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

@ -1,6 +1,6 @@
version: "3.7"
services:
oper-crm-server:
epmet-heart-server:
container_name: epmet-heart-server-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-heart-server:0.0.1
ports:

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.2</version>
<version>0.0.5</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-heart</artifactId>

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

@ -235,16 +235,15 @@ public class ResiActListController {
}
/**
* 重新定位
* 根据活动id前端传的实时经纬度与活动设置的经纬度相比较判断用户是否已到达打卡地点
*
* @param formDTO
* @return javax.xml.transform.Result
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActAddressResultDTO>
* @Author zhangyong
* @Date 16:48 2020-07-20
* @Date 11:21 2020-07-28
**/
@PostMapping("checksigninaddress")
public Result cancelSignUp(@RequestBody ResiActCaculateDistanceFormDTO formDTO) {
public Result<ResiActAddressResultDTO> cancelSignUp(@RequestBody ResiActCaculateDistanceFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActCaculateDistanceFormDTO.AddUserInternalGroup.class);
return actInfoService.checkSignInAddress(formDTO);
}
@ -275,7 +274,7 @@ public class ResiActListController {
**/
@PostMapping("insertlive")
public Result insertLive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActInsertLiveFormDTO.AddUserInternalGroup.class, ResiActInsertLiveFormDTO.AddUserShowGroup.class);
ValidatorUtils.validateEntity(formDTO, ResiActInsertLiveFormDTO.AddUserInternalGroup.class);
Result<String> result = actLiveRecService.insertLive(tokenDto, formDTO);
return new Result();
}
@ -290,7 +289,7 @@ public class ResiActListController {
**/
@PostMapping("signin")
public Result actSignIn(@LoginUser TokenDto tokenDto, @RequestBody ResiActSignInFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActSignInFormDTO.AddUserInternalGroup.class, ResiActSignInFormDTO.AddUserShowGroup.class);
ValidatorUtils.validateEntity(formDTO, ResiActSignInFormDTO.AddUserInternalGroup.class);
return actSignInRecService.actSignIn(tokenDto, formDTO);
}

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

@ -73,7 +73,7 @@ public class WorkActController {
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.work.InProgressActResultDTO>
* @param formDTO
* @author yinzuomei
* @description 进行中活动列表
* @description 进行中-活动列表
* @Date 2020/7/23 21:24
**/
@PostMapping("inprogresslist")
@ -157,7 +157,7 @@ public class WorkActController {
* @description 已结束-活动详情
* @Date 2020/7/26 21:01
**/
@PostMapping("finisheddeatil")
@PostMapping("finisheddetail")
public Result<FinishedActDetailResultDTO> finishedDeatil(@RequestBody ActIdFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class);
return new Result<FinishedActDetailResultDTO>().ok(workActService.finishedDeatil(formDTO));

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

@ -101,12 +101,13 @@ public interface ActInfoService extends BaseService<ActInfoEntity> {
/**
* 根据活动id前端传的实时经纬度与活动设置的经纬度相比较判断用户是否已到达打卡地点
* @param fromDTO
* @return javax.xml.transform.Result
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActAddressResultDTO>
* @Author zhangyong
* @Date 16:48 2020-07-20
* @Date 11:21 2020-07-28
**/
Result checkSignInAddress(ResiActCaculateDistanceFormDTO fromDTO);
Result<ResiActAddressResultDTO> checkSignInAddress(ResiActCaculateDistanceFormDTO formDTO);
/**
* 活动列表(包含状态报名中signing_up已报满enough截止报名: end_sign_up; 已开始 in_progress; 已结束finished)

17
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java

@ -23,7 +23,6 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -42,6 +41,8 @@ import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.CaculateDistance;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -57,6 +58,8 @@ import java.util.*;
@Service
public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntity> implements ActInfoService {
private Logger logger = LogManager.getLogger(ActInfoServiceImpl.class);
@Autowired
private ActInfoRedis actInfoRedis;
@ -355,14 +358,20 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
}
@Override
public Result checkSignInAddress(ResiActCaculateDistanceFormDTO formDTO) {
public Result<ResiActAddressResultDTO> checkSignInAddress(ResiActCaculateDistanceFormDTO formDTO) {
// 根据活动id,查询活动基本信息
ActInfoEntity entity = baseDao.selectById(formDTO.getActId());
Double distance = CaculateDistance.getDistance(formDTO.getLongitude(),formDTO.getLatitude(),entity.getActLongitude().doubleValue(),entity.getActLatitude().doubleValue());
ResiActAddressResultDTO dto = new ResiActAddressResultDTO();
if (distance <= entity.getSignInRadius()){
return new Result();
dto.setIsAddress(true);
dto.setErrorTip("");
return new Result<ResiActAddressResultDTO>().ok(dto);
} else {
throw new RenException(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getCode());
logger.info("您还未进入指定的签到范围~");
dto.setIsAddress(false);
dto.setErrorTip(EpmetErrorCode.NOT_IN_THE_SIGN_IN_RANGE.getMsg());
return new Result<ResiActAddressResultDTO>().ok(dto);
}
}

78
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java

@ -18,16 +18,23 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.client.utils.StringUtils;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.ActMessageConstant;
import com.epmet.dao.ActLivePicDao;
@ -42,15 +49,14 @@ import com.epmet.entity.ActLiveRecEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.ActLiveRecRedis;
import com.epmet.service.ActLiveRecService;
import com.epmet.utils.ValidityVerification;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 活动实况记录
@ -60,7 +66,7 @@ import java.util.stream.Collectors;
*/
@Service
public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiveRecEntity> implements ActLiveRecService {
private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class);
private Logger logger = LogManager.getLogger(ActLiveRecServiceImpl.class);
@Autowired
private ActLiveRecRedis actLiveRecRedis;
@ -71,6 +77,13 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
@Autowired
private ActLivePicDao actLivePicDao;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Override
public Result<ResiActLiveRecResultDTO> liveRecList(Map<String, String> map) {
if (map.get("actId") == null){
@ -125,11 +138,8 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
@Transactional(rollbackFor = Exception.class)
public Result<String> insertLive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
// 文本校验
ValidityVerification verification = new ValidityVerification();
verification.textScanVerification(formDTO.getDesc(),"添加实况-文本内容审核失败");
// 图片校验
verification.imgScanVerification(formDTO.getImages(),"添加实况-图片审核失败");
// 文本校验/图片校验
this.auditActContent(formDTO.getDesc(),formDTO.getImages());
// 存储活动实况记录表
String uuid = UUID.randomUUID().toString().replaceAll("-","");
@ -153,6 +163,56 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
return new Result<String>().ok(uuid);
}
/**
* 内容校验
*
* @param context 文本
* @param imgList 图片
* @return void
* @Author zhangyong
* @Date 10:15 2020-07-28
**/
private void auditActContent(String context, List<String> imgList) {
//审核活动详情中的内容
if(StringUtils.isNotBlank(context)){
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(context);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> contentSyncScanRes = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!contentSyncScanRes.success()) {
logger.error("添加实况接口失败,返参:", JSON.toJSONString(contentSyncScanRes));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!contentSyncScanRes.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
logger.info("添加实况成功");
}
if(null!=imgList&&imgList.size()>0){
//审核活动详情中的图片
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
logger.error("添加实况图片审核接口失败,返参:", JSON.toJSONString(imgScanResult));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
logger.info("添加实况审核成功");
}
}
private void grantActPoints(ResiActInsertLiveFormDTO formDTO){
//备注
String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_VOLUNTEER_LIVE,formDTO.getUserId(),formDTO.getActId());

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

@ -17,11 +17,21 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.client.utils.StringUtils;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.ActConstant;
import com.epmet.dao.ActSignInPicDao;
import com.epmet.dao.ActSignInRecDao;
@ -35,8 +45,10 @@ import com.epmet.entity.ActSignInRecEntity;
import com.epmet.redis.ActSignInRecRedis;
import com.epmet.service.ActLiveRecService;
import com.epmet.service.ActSignInRecService;
import com.epmet.utils.ValidityVerification;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -64,15 +76,20 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
@Autowired
private ActLiveRecService actLiveRecService;
private Logger logger = LogManager.getLogger(ActSignInRecServiceImpl.class);
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
@Override
@Transactional(rollbackFor = Exception.class)
public Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
// 文本校验
ValidityVerification verification = new ValidityVerification();
verification.textScanVerification(formDTO.getDesc(),"添加签到-文本内容审核失败");
// 图片校验
verification.imgScanVerification(formDTO.getImages(),"添加签到-图片审核失败");
// 文本校验/图片校验
this.auditActContent(formDTO.getDesc(),formDTO.getImages());
// 更新用户活动关系表 SIGN_IN_FLAG字段更新为已签到
ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO();
@ -109,4 +126,54 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
}
return new Result();
}
/**
* 内容校验
*
* @param context 文本
* @param imgList 图片
* @return void
* @Author zhangyong
* @Date 10:15 2020-07-28
**/
private void auditActContent(String context, List<String> imgList) {
//审核活动详情中的内容
if(StringUtils.isNotBlank(context)){
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(context);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> contentSyncScanRes = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!contentSyncScanRes.success()) {
logger.error("活动签到接口失败,返参:", JSON.toJSONString(contentSyncScanRes));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!contentSyncScanRes.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
logger.info("活动签到成功");
}
if(null!=imgList&&imgList.size()>0){
//审核活动详情中的图片
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
logger.error("活动签到图片审核接口失败,返参:", JSON.toJSONString(imgScanResult));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
logger.info("活动签到图片审核成功");
}
}
}

101
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java

@ -81,7 +81,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Autowired
private HeartUserInfoDao heartUserInfoDao;
private Logger logger = LogManager.getLogger(WorkActDraftServiceImpl.class);
private Logger logger = LogManager.getLogger(ActUserRelationServiceImpl.class);
@Override
public PageData<ActUserRelationDTO> page(Map<String, Object> params) {
@ -237,45 +237,19 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
Integer actTimeFlag = actInfoService.checkActTime(actInfoDTO);
if (actTimeFlag > NumConstant.ZERO){
signUp = false;
logger.info("活动报名失败,活动时间冲突");
logger.info("报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。");
throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode());
}
} else {
// 3.第一次报名
HeartUserInfoEntity entity = new HeartUserInfoEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setUserId(formDTO.getUserId());
entity.setVolunteerFlag(volunteerFlag > NumConstant.ZERO);
entity.setKindnessTime(NumConstant.ZERO);
entity.setParticipationNum(NumConstant.ZERO);
entity.setObtainPointNum(NumConstant.ZERO);
heartUserInfoDao.insert(entity);
this.insertHeartUserInfo(formDTO, volunteerFlag);
}
if (signUp){
// 4.插入活动日志表
ActUserLogEntity userLogEntity = new ActUserLogEntity();
userLogEntity.setActId(formDTO.getActId());
userLogEntity.setUserId(formDTO.getUserId());
userLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_AUDITING);
actUserLogService.insert(userLogEntity);
this.insertActUserLog(formDTO);
}
ActUserRelationEntity entity = new ActUserRelationEntity();
entity.setActId(formDTO.getActId());
entity.setUserId(formDTO.getUserId());
entity.setStatus(ActConstant.ACT_USER_STATUS_AUDITING);
// 审核开关:1报名人员需要人工审核(true) 0不需要(false)
if (actInfoDTO.getAuditSwitch()){
entity.setPassedType(ActConstant.PASSEDTYPE_MANUAL);
} else {
entity.setPassedType(ActConstant.PASSEDTYPE_AUTO);
entity.setAuditTime(new Date());
}
Integer operationCount = baseDao.selectCountByActIdAndUserId(formDTO.getActId(), formDTO.getUserId());
if (operationCount > NumConstant.ZERO){
// 用户如果不是第一次参加 这次的活动,先删除关系表中的数据,在插入
baseDao.delSignUpRecord(entity);
}
baseDao.insert(entity);
// 5.插入 用户活动关系表
this.insertActUserRelation(formDTO, actInfoDTO);
}
/**
@ -322,4 +296,67 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
return satisfy;
}
}
/**
* 第一次报名活动需插入用户信息表
* @param formDTO
* @param volunteerFlag
* @return void
* @Author zhangyong
* @Date 09:35 2020-07-28
**/
private void insertHeartUserInfo(ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){
HeartUserInfoEntity entity = new HeartUserInfoEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setUserId(formDTO.getUserId());
entity.setVolunteerFlag(volunteerFlag > NumConstant.ZERO);
entity.setKindnessTime(NumConstant.ZERO);
entity.setParticipationNum(NumConstant.ZERO);
entity.setObtainPointNum(NumConstant.ZERO);
heartUserInfoDao.insert(entity);
}
/**
* 每次成功报名活动都需要插入用户活动关系日志表
* @param formDTO
* @return void
* @Author zhangyong
* @Date 09:37 2020-07-28
**/
private void insertActUserLog(ResiActRegistrationFormDTO formDTO){
ActUserLogEntity userLogEntity = new ActUserLogEntity();
userLogEntity.setActId(formDTO.getActId());
userLogEntity.setUserId(formDTO.getUserId());
userLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_AUDITING);
actUserLogService.insert(userLogEntity);
}
/**
* 活动报名成功插入用户活动关系表重复报名先删除后插入
*
* @param formDTO
* @param actInfoDTO
* @return void
* @Author zhangyong
* @Date 09:41 2020-07-28
**/
private void insertActUserRelation(ResiActRegistrationFormDTO formDTO, ActInfoDTO actInfoDTO){
ActUserRelationEntity entity = new ActUserRelationEntity();
entity.setActId(formDTO.getActId());
entity.setUserId(formDTO.getUserId());
entity.setStatus(ActConstant.ACT_USER_STATUS_AUDITING);
// 审核开关:1报名人员需要人工审核(true) 0不需要(false)
if (actInfoDTO.getAuditSwitch()){
entity.setPassedType(ActConstant.PASSEDTYPE_MANUAL);
} else {
entity.setPassedType(ActConstant.PASSEDTYPE_AUTO);
entity.setAuditTime(new Date());
}
Integer operationCount = baseDao.selectCountByActIdAndUserId(formDTO.getActId(), formDTO.getUserId());
if (operationCount > NumConstant.ZERO){
// 用户如果不是第一次参加 这次的活动,先删除关系表中的数据,在插入
baseDao.delSignUpRecord(entity);
}
baseDao.insert(entity);
}
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java

@ -21,6 +21,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@ -104,6 +105,7 @@ public class GrantPointsServiceImpl implements GrantPointsService {
* @Date 2020/7/24 13:34
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void agree(GrantPointsFormDTO formDTO) {
//是否是待处理
ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId());
@ -148,6 +150,7 @@ public class GrantPointsServiceImpl implements GrantPointsService {
* @Date 2020/7/24 15:03
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void deny(GrantPointsFormDTO formDTO) {
//是否是待处理
ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId());

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -91,7 +91,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
this.grantActPoints(formDTO);
}
// 更新用户基础信息表 并 更新用户微信表
WxUserInfoFormDTO wxUserInfoFormDTO = ConvertUtils.sourceToTarget(formDTO, WxUserInfoFormDTO.class);
WxUserInfoFormDTO wxUserInfoFormDTO = this.packageWxUserInfo(formDTO);
return epmetUserOpenFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO);
}
@ -118,4 +118,21 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
logger.error("志愿者认证事件发送失败");
}
}
/**
* 根据志愿者认证参数组装微信基本信息
*
* @param formDTO
* @return com.epmet.dto.form.WxUserInfoFormDTO
* @Author zhangyong
* @Date 13:54 2020-07-28
**/
private WxUserInfoFormDTO packageWxUserInfo(ResiVolunteerAuthenticateFormDTO formDTO){
WxUserInfoFormDTO wxUserInfoFormDTO = new WxUserInfoFormDTO();
wxUserInfoFormDTO.setUserId(formDTO.getUserId());
wxUserInfoFormDTO.setNickName(formDTO.getNickname());
wxUserInfoFormDTO.setAvatarUrl(formDTO.getAvatarUrl());
wxUserInfoFormDTO.setGender(formDTO.getGender());
return wxUserInfoFormDTO;
}
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java

@ -16,6 +16,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
@ -92,6 +93,7 @@ public class WorkActDraftServiceImpl implements WorkActDraftService {
* @Date 2020/7/21 14:00
**/
@Override
@Transactional(rollbackFor = Exception.class)
public SaveActDraftResultDTO saveAct(DraftActInfoFormDTO formDTO) {
//保存活动属性
LatestActInfoDTO latestActInfoDTO=this.constructLatestActInfoDTO(formDTO);

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

@ -534,28 +534,41 @@ public class WorkActServiceImpl implements WorkActService {
// 活动状态:报名中:signing_up;截止报名: end_sign_up; 已开始: in_progress; 已报满: enough
if (nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == -1
|| nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == 0) {
logger.info(String.format("当前时间%s报名截止时间%s处于报名中",
DateUtils.format(nowDate,DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getSignUpEndTime(),DateUtils.DATE_TIME_PATTERN)));
//截止报名时间之前(包含报名时间截止时间点)
if (!inProgressActResultDTO.getActQuotaCategory()) {
//如果是不限制名额,则显示报名中
inProgressActResultDTO.setStatus("signing_up");
logger.info("活动不限制名额,界面显示 报名中");
continue;
} else {
//固定名额,且已报名人数<活动需要人数显示报名中
if (inProgressActResultDTO.getActQuota() > inProgressActResultDTO.getSignedUp()) {
logger.info("活动限制名额,未报满,界面显示报名中");
inProgressActResultDTO.setStatus("signing_up");
continue;
} else if (inProgressActResultDTO.getActQuota().equals(inProgressActResultDTO.getSignedUp())) {
inProgressActResultDTO.setStatus("enough");
logger.info("活动限制名额,且已报满,界面显示已报满");
continue;
}
}
} else if (nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == 1
|| nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == -1) {
&&nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == -1) {
logger.info(String.format("当前时间%s报名截止时间%s活动预计开始时间%s界面显示截止报名",
DateUtils.format(nowDate,DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getSignUpEndTime(),DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getActStartTime(),DateUtils.DATE_TIME_PATTERN)));
//活动报名截止-活动预计开始之间显示截止报名
inProgressActResultDTO.setStatus("end_sign_up");
continue;
} else if (nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == 1
|| nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == 0) {
logger.info(String.format("当前时间%s活动预计开始时间%s界面显示已开始",
DateUtils.format(nowDate,DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getActStartTime(),DateUtils.DATE_TIME_PATTERN)));
//活动预计开始时间点之后,包含活动预计开始时间点,显示 已开始
inProgressActResultDTO.setStatus("in_progress");
continue;
@ -596,6 +609,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/26 17:26
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void cancelAct(CancelActFormDTO formDTO) {
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
if(null==actInfoDTO){
@ -671,6 +685,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/26 19:49
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveActualTime(SaveActualTimeFormDTO formDTO) {
if(formDTO.getActualStartTime().compareTo(formDTO.getActualEndTime())!=-1){
throw new RenException(EpmetErrorCode.ACT_ACTUAL_START_TIME_ERROR.getCode());
@ -736,6 +751,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/26 21:48
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void finishAct(String actId) {
ActInfoDTO actInfoDTO=actInfoService.get(actId);
if(null==actInfoDTO){
@ -862,10 +878,13 @@ public class WorkActServiceImpl implements WorkActService {
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode());
}
//如果活动设置的分支大于0,需要判断是否已经处理完毕
//待处理事项为空时才可以结束活动
List<ActUserRelationDTO> list=actUserRelationDao.selectInProgress(actInfoDTO.getId());
if(null!=list&&list.size()>0){
throw new RenException(EpmetErrorCode.HAVE_HANDLE.getCode());
if(actInfoDTO.getReward()>0){
List<ActUserRelationDTO> list=actUserRelationDao.selectInProgress(actInfoDTO.getId());
if(null!=list&&list.size()>0){
throw new RenException(EpmetErrorCode.HAVE_HANDLE.getCode());
}
}
//先填写实际开始时间、实际结束时间
if(null==actInfoDTO.getActualStartTime()||null==actInfoDTO.getActualEndTime()){
@ -882,6 +901,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/27 10:45
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void summaryAct(SummaryActFormDTO formDTO) {
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
if(null==actInfoDTO){
@ -958,6 +978,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/27 13:55
**/
@Override
@Transactional(rollbackFor = Exception.class)
public PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO) {
ActInfoDTO originalActInfo=actInfoService.get(rePublishFormDTO.getActId());
if(null==originalActInfo){

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

@ -13,11 +13,15 @@ import com.epmet.constant.ReadFlagConstant;
import com.epmet.dao.ActInfoDao;
import com.epmet.dao.ActUserLogDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActInfoDTO;
import com.epmet.dto.ActUserLogDTO;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.dto.form.work.*;
import com.epmet.dto.form.work.AactUserDetailFormDTO;
import com.epmet.dto.form.work.ActIdFormDTO;
import com.epmet.dto.form.work.AuditUserFormDTO;
import com.epmet.dto.form.work.UserHistoricalActFormDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.work.*;
import com.epmet.entity.ActInfoEntity;
@ -25,6 +29,7 @@ import com.epmet.entity.ActUserLogEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserRelationService;
import com.epmet.service.HeartUserInfoService;
import com.epmet.service.WorkActUserService;
@ -32,6 +37,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
@ -62,6 +68,8 @@ public class WorkActUserServiceImpl implements WorkActUserService {
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private ActInfoService actInfoService;
/**
* @param formDTO
* @return java.util.List<com.epmet.dto.result.work.AuditingActUserResultDTO>
@ -358,6 +366,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
* @Date 2020/7/23 17:30
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void auditPass(String actUserRelationId) {
ActUserRelationEntity actUserRelationEntity=actUserRelationDao.selectById(actUserRelationId);
if(null==actUserRelationEntity||!ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserRelationEntity.getStatus())){
@ -404,6 +413,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
* @Date 2020/7/23 18:14
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void auditRefuse(AuditUserFormDTO formDTO) {
ActUserRelationEntity actUserRelationEntity=actUserRelationDao.selectById(formDTO.getActUserRelationId());
if(null==actUserRelationEntity||!ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserRelationEntity.getStatus())){
@ -451,6 +461,11 @@ public class WorkActUserServiceImpl implements WorkActUserService {
**/
@Override
public List<JoinedUserResultDTO> queryJoinUserList(ActIdFormDTO formDTO) {
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
if(null==actInfoDTO){
logger.error("act_info is null");
return new ArrayList<>();
}
List<JoinedUserResultDTO> list=actInfoDao.queryJoinUserList(formDTO.getActId());
if(null!=list&&list.size()>0){
//查询已通过审核的人员id集合
@ -458,11 +473,21 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//根据已通过的人员集合,查询出用户基本信息
List<UserBaseInfoResultDTO> userInfoList=this.queryUserBaseInfoList(userIdList);
for(JoinedUserResultDTO joinedUserResultDTO:list){
//积分描述赋值
if(ActConstant.ACT_USER_STATUS_AGREE.equals(joinedUserResultDTO.getRewardFlag())){
joinedUserResultDTO.setPointsDes(String.format("积分+%s",joinedUserResultDTO.getReward()));
}else if(ActConstant.ACT_USER_STATUS_DENY.equals(joinedUserResultDTO.getRewardFlag())){
joinedUserResultDTO.setPointsDes("积分+0");
if(actInfoDTO.getActStatus().equals(ActConstant.ACT_STATUS_FINISHED)){
//积分描述赋值
if(ActConstant.ACT_USER_STATUS_AGREE.equals(joinedUserResultDTO.getRewardFlag())){
joinedUserResultDTO.setPointsDes(String.format("积分+%s",joinedUserResultDTO.getReward()));
}else if(ActConstant.ACT_USER_STATUS_DENY.equals(joinedUserResultDTO.getRewardFlag())){
joinedUserResultDTO.setPointsDes("积分+0");
}
}else{
logger.info("当前活动未结束,活动状态:"+actInfoDTO.getActStatus());
joinedUserResultDTO.setPointsDes(StrConstant.EPMETY_STR);
}
if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(joinedUserResultDTO.getSignInFlagStr())){
joinedUserResultDTO.setSignInFlag(true);
}else{
joinedUserResultDTO.setSignInFlag(false);
}
//志愿者标识赋值
joinedUserResultDTO.setVolunteerFlag(this.getVolunteerFlag(joinedUserResultDTO.getUserId()));

94
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java

@ -1,94 +0,0 @@
package com.epmet.utils;
import com.alibaba.nacos.client.utils.StringUtils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
import com.epmet.commons.tools.scan.param.ImgTaskDTO;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import org.springframework.beans.factory.annotation.Value;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.UUID;
/**
* 文字图片合法性校验
*
* @author zhangyong
* @date 2020-07-15 14:26
*/
@Slf4j
public class ValidityVerification {
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
/**
* 文本校验
* @param context 被校验的文本不能超过10000
* @param businessEnum 业务枚举定义校验失败后输出的日志信息
* @return void
* @auther zhangyong
* @Date 14:42 2020-07-15
**/
public void textScanVerification(String context, String businessEnum){
if (StringUtils.isNotBlank(context)) {
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(context);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()) {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
// 业务枚举:例如:评论话题失败,评论内容为:%s"
log.error(String.format(businessEnum, context));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
}
}
/**
* 图片列表校验
* @param imgList 被校验的图片列表
* @param businessEnum 业务枚举定义校验失败后输出的日志信息
*
* @return void
* @auther zhangyong
* @Date 14:42 2020-07-15
**/
public void imgScanVerification(List<String> imgList, String businessEnum){
if (null != imgList && NumConstant.ZERO != imgList.size()){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
// 业务枚举:例如:评论话题失败,评论内容为:%s"
log.error(String.format(businessEnum));
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
}
}
}

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

@ -0,0 +1,423 @@
/*
Navicat Premium Data Transfer
Source Server : 192.168.1.130
Source Server Type : MySQL
Source Server Version : 50728
Source Host : 118.190.150.119:47306
Source Schema : epmet_heart
Target Server Type : MySQL
Target Server Version : 50728
File Encoding : 65001
Date: 28/07/2020 15:17:47
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for act_content
-- ----------------------------
DROP TABLE IF EXISTS `act_content`;
CREATE TABLE `act_content` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id:act_info.id',
`CONTENT` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容',
`CONTENT_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容类型 图片:img;文字:text',
`ORDER_NUM` int(11) NOT NULL COMMENT '内容顺序 从1开始',
`DEL_FLAG` int(11) NOT NULL DEFAULT 0 COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动内容' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_customized
-- ----------------------------
DROP TABLE IF EXISTS `act_customized`;
CREATE TABLE `act_customized` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键(客户如果没配置,默认的值写在代码里)',
`CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户id',
`TITLE_NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题:eg: 志愿者去哪儿',
`HOTLINE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '咨询热线',
`ACT_LIST_NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动列表',
`HEART_RANK_NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '爱心榜',
`ACT_REVIEW_NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动回顾',
`MY_ACT_NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '我的活动',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '爱心互助首页自定义配置' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_info
-- ----------------------------
DROP TABLE IF EXISTS `act_info`;
CREATE TABLE `act_info` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户id',
`TITLE` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动标题',
`COVER_PIC` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动封面',
`SIGN_UP_START_TIME` datetime(0) NOT NULL COMMENT '报名开始时间',
`SIGN_UP_END_TIME` datetime(0) NOT NULL COMMENT '报名截止时间',
`REQUIREMENT` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '招募要求',
`ACT_START_TIME` datetime(0) NOT NULL COMMENT '活动开始时间',
`ACT_END_TIME` datetime(0) NOT NULL COMMENT '活动结束时间',
`ACT_ADDRESS` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动地点',
`ACT_LONGITUDE` decimal(32, 10) NOT NULL COMMENT '活动位置经度',
`ACT_LATITUDE` decimal(32, 10) NOT NULL COMMENT '活动位置纬度',
`SIGN_IN_START_TIME` datetime(0) NOT NULL COMMENT '打卡开始时间',
`SIGN_IN_END_TIME` datetime(0) NOT NULL COMMENT '打卡截止时间',
`SIGN_IN_ADDRESS` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动签到打卡地点',
`SIGN_IN_LONGITUDE` decimal(32, 10) NOT NULL COMMENT '活动签到打卡位置经度',
`SIGN_IN_LATITUDE` decimal(32, 10) NOT NULL COMMENT '活动签到打卡位置纬度',
`SIGN_IN_RADIUS` int(11) NOT NULL COMMENT '活动签到打卡半径(单位:米)',
`ACT_QUOTA_CATEGORY` tinyint(1) NOT NULL DEFAULT 0 COMMENT '活动名额类型(0-不限名额,1-固定名额)',
`ACT_QUOTA` int(11) NULL DEFAULT 0 COMMENT '活动名额',
`ACT_STATUS` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1' COMMENT '活动状态(\r\n已发布/报名中:published;\r\n已取消:canceled;\r\n已结束:finished)',
`CANCEL_REASON` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动取消的原因',
`CANCEL_TIME` datetime(0) NULL DEFAULT NULL COMMENT '取消活动的时间',
`SPONSOR_CONTACTS` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系人',
`SPONSOR_TEL` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系电话',
`SPONSOR_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '发布名义:网格主办:grid;组织主办:agency',
`SPONSOR_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主办方id(机关或网格的id)',
`SPONSOR_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动主办方名称(机关或网格的名称)',
`PID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '发布单位的上一级组织id,如果是以网格发布,此列存储的是网格所属机关的上一级机关',
`REWARD` int(11) NOT NULL DEFAULT 0 COMMENT '活动奖励积分',
`VOLUNTEER_LIMIT` tinyint(1) NOT NULL COMMENT '身份限制:1只有志愿者才可以参加活动0不限制志愿者身份',
`AUDIT_SWITCH` tinyint(1) NOT NULL COMMENT '审核开关:1报名人员需要人工审核0不需要',
`ACTUAL_START_TIME` datetime(0) NULL DEFAULT NULL COMMENT '活动实际开始时间',
`ACTUAL_END_TIME` datetime(0) NULL DEFAULT NULL COMMENT '活动实际结束时间',
`SERVICE_MIN` int(11) NULL DEFAULT NULL COMMENT '活动共计时长(服务时间)单位:分钟',
`SUMMARY_FLAG` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1已经总结0未总结',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间(活动发布时间)',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标识',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动信息' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for act_live_pic
-- ----------------------------
DROP TABLE IF EXISTS `act_live_pic`;
CREATE TABLE `act_live_pic` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`LIVE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '实况ID:act_live.id',
`PIC_URL` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '图片地址',
`SORT` int(11) NOT NULL COMMENT '排序从1开始',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标志',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动实况图片表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for act_live_rec
-- ----------------------------
DROP TABLE IF EXISTS `act_live_rec`;
CREATE TABLE `act_live_rec` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id: act_info.id',
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`LONGITUDE` decimal(32, 10) NULL DEFAULT NULL COMMENT '实况打卡位置经度',
`LATITUDE` decimal(32, 10) NULL DEFAULT NULL COMMENT '实况打卡位置纬度',
`ADDRESS` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实况打卡地址',
`DESC` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实况打卡描述',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
INDEX `epmet_act_user_clock_log_ACT_USER_ID_IDX`(`ACT_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动实况记录' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for act_operation_rec
-- ----------------------------
DROP TABLE IF EXISTS `act_operation_rec`;
CREATE TABLE `act_operation_rec` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id',
`TYPE` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '发布:publish;\r\n取消活动:cancel;\r\n结束活动:finish\r\n重新编辑:update',
`NOTICE_USER` tinyint(1) NOT NULL DEFAULT 0 COMMENT '1通知用户0不通知,取消活动时默认true',
`REMARK` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注,取消活动时此列有值',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动操作日志表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_point_log
-- ----------------------------
DROP TABLE IF EXISTS `act_point_log`;
CREATE TABLE `act_point_log` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键(给分或者不给分,以及重新处理插入本表)',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id',
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`POINTS` int(11) NOT NULL COMMENT '积分值',
`OPERATE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作类型:\r\n同意给分agree; 不给分:deny;重新处理: reset',
`REMARK` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注:拒绝给分和重新处理时录入的理由',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标识 0-否,1-是',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人(工作人员id)',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动发放积分日志表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_sign_in_pic
-- ----------------------------
DROP TABLE IF EXISTS `act_sign_in_pic`;
CREATE TABLE `act_sign_in_pic` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`SIGN_IN_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '签到记录ID:act_sign_in_record.id',
`PIC_URL` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '图片地址',
`SORT` int(11) NOT NULL COMMENT '排序从1开始',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标志',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动签到图片表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for act_sign_in_rec
-- ----------------------------
DROP TABLE IF EXISTS `act_sign_in_rec`;
CREATE TABLE `act_sign_in_rec` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id:act_info.id',
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`LONGITUDE` decimal(32, 10) NOT NULL COMMENT '签到位置经度',
`LATITUDE` decimal(32, 10) NOT NULL COMMENT '签到位置纬度',
`ADDRESS` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '签到地址',
`DESC` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '签到描述',
`SYNC_LIVE` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0不同步实况1同步到实况记录',
`LIVE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实况id,党sync_live=1时此列有值',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动签到记录' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_statistical
-- ----------------------------
DROP TABLE IF EXISTS `act_statistical`;
CREATE TABLE `act_statistical` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键(活动结束后插入本表)',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id',
`SIGNUP_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '已报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数)',
`AUDITING_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '待审核',
`PASSED_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '审核通过',
`REFUSED_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '审核不通过总人数',
`CANCELD_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '取消报名的人数',
`SIGNED_IN_USER_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '活动已签到人数',
`REWARD_USER_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '发放积分总人数',
`DENY_REWARD_USER_NUM` int(11) NOT NULL DEFAULT 0 COMMENT '拒绝发放积分总人数',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标识',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动统计信息' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_summary
-- ----------------------------
DROP TABLE IF EXISTS `act_summary`;
CREATE TABLE `act_summary` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键ID',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动ID:act_info.id',
`CONTENT` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容',
`CONTENT_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容类型 图片:img;文字:text',
`ORDER_NUM` int(11) NOT NULL COMMENT '内容顺序 从1开始',
`DEL_FLAG` int(11) NOT NULL DEFAULT 0 COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动回顾表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_user_log
-- ----------------------------
DROP TABLE IF EXISTS `act_user_log`;
CREATE TABLE `act_user_log` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动ID',
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID',
`OPERATION_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作类型(已报名/待审核auditing,\r\n审核通过passed,\r\n审核不通过refused\r\n取消报名canceled,\r\n)',
`REASON` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作备注:(1)审核不通过的原因\r\n(2)取消报名的原因|\r\n(3)拒绝发放积分的理由\r\n(4)重新处理的理由',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间(操作的时间)',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户活动关系日志表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for act_user_relation
-- ----------------------------
DROP TABLE IF EXISTS `act_user_relation`;
CREATE TABLE `act_user_relation` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键(用户-活动一对一,报名取消再报名也只有一条记录)',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动ID',
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户ID',
`STATUS` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '当前状态(已报名/待审核auditing,\r\n审核通过passed,\r\n审核不通过refused\r\n取消报名canceled,\r\n)',
`PASSED_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '审核通过类型:auto, manual',
`AUDIT_TIME` datetime(0) NULL DEFAULT NULL COMMENT '审核时间(同意、拒绝的时间)',
`FAILURE_REASON` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '未通过原因',
`CANCEL_TIME` datetime(0) NULL DEFAULT NULL COMMENT '取消报名的时间',
`CANCEL_REASON` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户取消报名的原因',
`PROCESS_FLAG` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '已处理: handled; 默认\"\",重新处理时reward_flag置为空字符串',
`SIGN_IN_FLAG` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '已签到:signed_in; 默认\"\"',
`REWARD_FLAG` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '已给分:agree, 不给分:deny 默认\"\"',
`DENY_REWARD_REASON` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '拒绝发放积分备注',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间(报名时间)',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
INDEX `epmet_act_user_relation_ACT_ID_IDX`(`ACT_ID`, `USER_ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户活动关系表' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for heart_user_info
-- ----------------------------
DROP TABLE IF EXISTS `heart_user_info`;
CREATE TABLE `heart_user_info` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键(用户提交报名成功后,插入本表)',
`CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户id',
`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)',
`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 '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户信息' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for latest_act_content
-- ----------------------------
DROP TABLE IF EXISTS `latest_act_content`;
CREATE TABLE `latest_act_content` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id:latest_act_info.id',
`CONTENT` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容',
`CONTENT_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容类型 图片:img;文字:text',
`ORDER_NUM` int(11) NOT NULL COMMENT '内容顺序 从1开始',
`DEL_FLAG` int(11) NOT NULL DEFAULT 0 COMMENT '删除标识 0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '最近一次编辑的活动内容' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for latest_act_info
-- ----------------------------
DROP TABLE IF EXISTS `latest_act_info`;
CREATE TABLE `latest_act_info` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户id',
`TITLE` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '活动标题',
`COVER_PIC` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '活动封面',
`SIGN_UP_START_TIME` datetime(0) NULL DEFAULT NULL COMMENT '报名开始时间',
`SIGN_UP_END_TIME` datetime(0) NULL DEFAULT NULL COMMENT '报名截止时间',
`REQUIREMENT` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '招募要求',
`ACT_START_TIME` datetime(0) NULL DEFAULT NULL COMMENT '活动开始时间',
`ACT_END_TIME` datetime(0) NULL DEFAULT NULL COMMENT '活动结束时间',
`ACT_ADDRESS` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '活动地点',
`ACT_LONGITUDE` decimal(32, 10) NULL DEFAULT NULL COMMENT '活动位置经度',
`ACT_LATITUDE` decimal(32, 10) NULL DEFAULT NULL COMMENT '活动位置纬度',
`SIGN_IN_START_TIME` datetime(0) NULL DEFAULT NULL COMMENT '打卡开始时间',
`SIGN_IN_END_TIME` datetime(0) NULL DEFAULT NULL COMMENT '打卡截止时间',
`SIGN_IN_ADDRESS` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '活动签到打卡地点',
`SIGN_IN_LONGITUDE` decimal(32, 10) NULL DEFAULT NULL COMMENT '活动签到打卡位置经度',
`SIGN_IN_LATITUDE` decimal(32, 10) NULL DEFAULT NULL COMMENT '活动签到打卡位置纬度',
`SIGN_IN_RADIUS` int(11) NULL DEFAULT NULL COMMENT '活动签到打卡半径(单位:米)',
`ACT_QUOTA_CATEGORY` tinyint(1) NULL DEFAULT NULL COMMENT '活动名额类型(0-不限名额,1-固定名额)',
`ACT_QUOTA` int(11) NULL DEFAULT 0 COMMENT '活动名额',
`SPONSOR_CONTACTS` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '联系人',
`SPONSOR_TEL` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '联系电话',
`SPONSOR_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '主办方类型:网格主办:grid;组织主办:agency',
`SPONSOR_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '主办方id(机关或网格的id)',
`SPONSOR_NAME` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '活动主办方名称(机关或网格的名称)',
`PID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '如果以网格名义发布,存储空字符串\"\"',
`REWARD` int(11) NULL DEFAULT 0 COMMENT '活动奖励积分',
`VOLUNTEER_LIMIT` tinyint(1) NULL DEFAULT NULL COMMENT '身份限制:1只有志愿者才可以参加活动0不限制志愿者身份',
`AUDIT_SWITCH` tinyint(1) NULL DEFAULT NULL COMMENT '审核开关:1报名人员需要人工审核0不需要',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '删除标识',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '最近一次编辑的活动信息' ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for volunteer_info
-- ----------------------------
DROP TABLE IF EXISTS `volunteer_info`;
CREATE TABLE `volunteer_info` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键(志愿者注册后插入本表)',
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户id',
`VOLUNTEER_INTRODUCE` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '志愿者自我介绍',
`VOLUNTEER_SIGNATURE` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '志愿者签名',
`DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除标记',
`REVISION` int(11) NOT NULL DEFAULT 0 COMMENT '乐观锁',
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间(认证志愿者时间)',
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '志愿者信息' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;

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

@ -300,7 +300,7 @@
then 'in_progress'
end as actCurrentState
FROM act_info i
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
WHERE i.DEL_FLAG = '0'
AND i.CUSTOMER_ID = #{customerId}
AND i.ACT_STATUS != 'finished' AND i.ACT_STATUS != 'canceled'
@ -403,7 +403,7 @@
IF(aur.SIGN_IN_FLAG = 'signed_in', true , false ) as isSignUp-- 是否已签到(true已签到,false未签到)
FROM
act_info i
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID
LEFT JOIN act_user_relation aur ON aur.ACT_ID = i.ID AND aur.DEL_FLAG = '0' AND aur.USER_ID = #{userId}
WHERE
i.DEL_FLAG = '0'
@ -483,7 +483,8 @@
AND ( aur.`STATUS` = 'auditing' OR aur.`STATUS` = 'passed' )
) AS signedUp,
ai.SIGN_UP_END_TIME as signUpEndTime,
ai.SIGN_UP_START_TIME as signUpStartTime
ai.SIGN_UP_START_TIME as signUpStartTime,
ai.ACT_ADDRESS as actAddress
FROM
act_info ai
WHERE
@ -502,7 +503,8 @@
ai.ACT_START_TIME AS actStartTime,
ai.ACT_END_TIME AS actEndTime,
ai.CANCEL_TIME AS cancelTime,
ai.CANCEL_REASON AS cancelReason
ai.CANCEL_REASON AS cancelReason,
ai.ACT_ADDRESS as actAddress
FROM
act_info ai
WHERE
@ -522,7 +524,8 @@
ai.ACT_START_TIME AS actStartTime,
ai.ACT_END_TIME AS actEndTime,
ai.ACTUAL_START_TIME as actualStartTime,
ai.ACTUAL_END_TIME as actualEndTime
ai.ACTUAL_END_TIME as actualEndTime,
ai.ACT_ADDRESS as actAddress
FROM
act_info ai
WHERE
@ -539,7 +542,7 @@
aur.id as actUserRelationId,
aur.ACT_ID ,
aur.USER_ID ,
aur.SIGN_IN_FLAG,
aur.SIGN_IN_FLAG as signInFlagStr,
aur.CREATED_TIME as signUpTime,
ai.REWARD,
aur.REWARD_FLAG,

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

@ -3,7 +3,7 @@ services:
epmet-oss-server:
container_name: epmet-oss-server-dev
# image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/epmet-oss-server:0.3.2
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.23
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.24
ports:
- "8083:8083"
network_mode: host # 使用现有网络

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

@ -3,7 +3,7 @@ services:
epmet-oss-server:
container_name: epmet-oss-server-test
# image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-test/epmet-oss-server:0.3.2
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-oss-server:0.3.23
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-oss-server:0.3.24
ports:
- "8083:8083"
network_mode: host # 使用现有网络

2
epmet-module/epmet-oss/epmet-oss-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.23</version>
<version>0.3.24</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-oss</artifactId>

106
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointAdjustmentLogDTO.java

@ -0,0 +1,106 @@
/**
* 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;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-27
*/
@Data
public class PointAdjustmentLogDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 关联的积分动作Id
*/
private String actionId;
/**
* 调整人名称xx机关-xx
*/
private String operatorName;
/**
* 调整原因
*/
private String adjustReason;
/**
* 调整积分
*/
private Integer point;
/**
* plus/minus
*/
private String adjustmentType;
/**
* 调整人所属机关Id
*/
private String operatorAgencyId;
/**
* 居民Id
*/
private String userId;
/**
*
*/
private String delFlag;
/**
*
*/
private Integer revision;
/**
*
*/
private Date createdTime;
/**
*
*/
private String createdBy;
/**
*
*/
private Date updatedTime;
/**
*
*/
private String updatedBy;
}

10
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointVerificationLogDTO.java

@ -48,16 +48,6 @@ public class PointVerificationLogDTO implements Serializable {
*/
private String userId;
/**
* 核销对象首次注册网格
*/
private String userRegistedGridId;
/**
* 核销对象首次注册网格所在机关
*/
private String userRegistedAgnecyId;
/**
* 核销人员ID
*/

29
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/CommonPageUserFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 用户Id 分页参数
* @ClassName CommonPageUserFormDTO
* @Auth wangc
* @Date 2020-07-24 13:24
*/
@Data
public class CommonPageUserFormDTO implements Serializable {
private static final long serialVersionUID = -6721313124444595189L;
public interface PageUserGroup extends CustomerClientShowGroup{}
@NotBlank(message = "获取不到用户Id" , groups = PageUserGroup.class)
private String userId;
@Min(value = 1)
private Integer pageNo = 1;
private Integer pageSize = 10;
}

56
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointAdjustmentFormDTO.java

@ -0,0 +1,56 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 积分调整传参积分dto
* @ClassName PointAdjustmentFormDTO
* @Auth wangc
* @Date 2020-07-27 13:36
*/
@Data
public class PointAdjustmentFormDTO implements Serializable {
private static final long serialVersionUID = -1879530107301465633L;
public interface PointAdjustmentGroup extends CustomerClientShowGroup{}
/**
* 用户Id
* */
@NotBlank(message = "用户Id不能为空", groups = PointAdjustmentGroup.class)
private String userId;
/**
* 积分调整标识 key:add/minus
* */
@NotBlank(message = "调整类型不能为空", groups = PointAdjustmentGroup.class)
private String adjustmentType;
/**
* 调整的分值
* */
private Integer point;
/**
* 调整原因
* */
@NotBlank(message = "调整原因不能为空", groups = PointAdjustmentGroup.class)
private String reason;
/**
* 操作人Id
* */
@NotBlank(message = "当前工作人员Id不能为空", groups = PointAdjustmentGroup.class)
private String operatorId;
/**
* 客户Id
* */
@NotBlank(message = "客户Id不能为空", groups = PointAdjustmentGroup.class)
private String customerId;
}

53
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointVerificationFormDTO.java

@ -0,0 +1,53 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 积分核销传参dto
*
* @ClassName PointVerificationFormDTO
* @Auth wangc
* @Date 2020-07-27 13:45
*/
@Data
public class PointVerificationFormDTO implements Serializable {
private static final long serialVersionUID = -154634518066538184L;
public interface PointVerificationGroup extends CustomerClientShowGroup{}
/**
* 用户Id
* */
@NotBlank(message = "用户Id不能为空", groups = PointVerificationGroup.class)
private String userId;
/**
* 核销备注
* */
@NotBlank(message = "核销备注不能为空", groups = PointVerificationGroup.class)
private String remark;
/**
* 核销积分数
* */
@Min(0)
private Integer point;
/**
* 操作人Id
* */
@NotBlank(message = "当前工作人员Id不能为空", groups = PointVerificationGroup.class)
private String operatorId;
private String longitude;
private String dimension;
private String address;
}

4
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiCommonUserIdFormDTO.java

@ -16,8 +16,8 @@ import java.io.Serializable;
public class ResiCommonUserIdFormDTO implements Serializable {
private static final long serialVersionUID = -1961545266124776452L;
public interface UserId extends CustomerClientShowGroup{}
public interface UserIdGroup extends CustomerClientShowGroup{}
@NotBlank(message = "获取不到用户Id",groups = UserId.class)
@NotBlank(message = "获取不到用户Id",groups = UserIdGroup.class)
private String userId;
}

20
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/ResiPointRankFormDTO.java

@ -1,8 +1,10 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -15,19 +17,29 @@ import java.io.Serializable;
public class ResiPointRankFormDTO implements Serializable {
private static final long serialVersionUID = 1534061512200591149L;
public interface ResiPointRankGroup extends CustomerClientShowGroup{}
/**
* 页码
* */
@Min(1)
private Integer pageNo;
@Min(value = 1,groups = ResiPointRankGroup.class)
private Integer pageNo = 1;
/**
* 每页数据条数
* */
private Integer pageSize;
private Integer pageSize = 10;
/**
* 时间维度 week month
* 时间维度 week month 如果为空则按照week处理
* */
private String timeDimension;
@NotBlank(message = "获取不到用户Id",groups = ResiPointRankGroup.class)
private String userId;
/**
* 客户Id不做校验如果前端不传则使用userId查询相应的客户Id
* */
private String customerId;
}

32
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/WorkPointVerificationFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 工作端核销记录传参
* @ClassName WorkPointVerificationFormDTO
* @Auth wangc
* @Date 2020-07-24 16:25
*/
@Data
public class WorkPointVerificationFormDTO implements Serializable {
private static final long serialVersionUID = -590822390667788693L;
@NotBlank(message = "获取不到用户Id",groups = ResiCommonUserIdFormDTO.UserIdGroup.class)
private String staffId;
/**
* yyyy-MM
* */
private String timeParam;
@Min(1)
private Integer pageNo;
private Integer pageSize;
}

36
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointAdjustmentResultDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @ClassName PointAdjustmentResultDTO
* @Auth wangc
* @Date 2020-07-27 09:45
*/
@Data
public class PointAdjustmentResultDTO implements Serializable {
private static final long serialVersionUID = -5339173292750971212L;
/**
* 操作日期
* */
private String date;
/**
* 调整积分
* */
private String point;
/**
* 调整原因
* */
private String reason;
/**
* 调整人昵称
* */
private String staffNickname;
}

2
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java

@ -19,6 +19,6 @@ public class PointDetailResultDTO implements Serializable {
private Integer point;
private String pointUnit;
private String upLimit;
private String enabledFlag;
private Boolean enabledFlag;
private String upLimitDesc;
}

1
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java

@ -16,6 +16,7 @@ public class PointRuleResultDTO implements Serializable {
private String ruleId;
private String ruleName;
private String ruleDesc;
private Boolean enabledFlag;
/**
* 拼接好的 积分值/单位
*/

36
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointVerificationResultDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 积分核销返参Dto
* @ClassName PointVerificationResultDTO
* @Auth wangc
* @Date 2020-07-27 13:57
*/
@Data
public class PointVerificationResultDTO implements Serializable {
private static final long serialVersionUID = 6990717665110392389L;
/**
* 核销成功标识
* */
private boolean successFlag;
/**
* 失败原因
* */
private String failureReason;
/**
* 用户(居民)昵称
* */
private String userNickname;
/**
* 用户(居民)头像
* */
private String userHeadPhoto;
}

2
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/ResiPointRankListResultDTO.java

@ -33,5 +33,5 @@ public class ResiPointRankListResultDTO implements Serializable {
/**
* 积分排名列表
* */
private List<ResiPointRankingResultDTO> rankList;
private ResiPointRankingResultDTO rankList;
}

27
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerficationListResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 工作端积分核销记录列表
* @ClassName WorkPointVerficationListResultDTO
* @Auth wangc
* @Date 2020-07-24 15:38
*/
@Data
public class WorkPointVerficationListResultDTO implements Serializable {
private static final long serialVersionUID = 2737976236826002595L;
/**
* 当月总积分
* */
private Integer totalPoint;
/**
* 核销列表
* */
List<WorkPointVerificationDetailResultDTO> checkingList;
}

33
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationDetailResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 工作端积分核销显示记录
* @ClassName WorkPointVerificationDetailResultDTO
* @Auth wangc
* @Date 2020-07-24 15:38
*/
@Data
public class WorkPointVerificationDetailResultDTO implements Serializable {
private static final long serialVersionUID = -205177259417194562L;
/**
* 被核销用户昵称
* */
private String userNickname;
/**
* 核销积分 "-100"
* */
private String point;
/**
* 核销备注
* */
private String remark;
}

38
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/WorkPointVerificationLogResultDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 工作端积分核销记录
* @ClassName WorkPointVerificationLogResultDTO
* @Auth wangc
* @Date 2020-07-24 15:38
*/
@Data
public class WorkPointVerificationLogResultDTO implements Serializable {
private static final long serialVersionUID = -3570820382554221450L;
/**
* 积分
* */
private Integer point;
/**
* 用户Id
* */
private String userId;
/**
* 日期 yyyy-MM-dd HH:mm:ss
* */
private String date;
/**
* 核销备注
* */
private String remark;
}

15
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/EpmetPointOpenFeignClient.java

@ -1,8 +1,13 @@
package com.epmet.feign;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.ResiPointDetailResultDTO;
import com.epmet.feign.fallback.EpmetPointOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -12,4 +17,14 @@ import org.springframework.cloud.openfeign.FeignClient;
*/
@FeignClient(name = ServiceConstant.EPMET_HEART_SERVER, fallback = EpmetPointOpenFeignClientFallback.class)
public interface EpmetPointOpenFeignClient {
/**
* @Description 获取指定居民的积分信息
* @param dto
* @return
* @author wangc
* @date 2020.07.22 15:58
**/
@GetMapping("mypoint")
Result<ResiPointDetailResultDTO> myPoint(TokenDto dto);
}

9
epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/feign/fallback/EpmetPointOpenFeignClientFallback.java

@ -1,5 +1,10 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.ResiPointDetailResultDTO;
import com.epmet.feign.EpmetPointOpenFeignClient;
import org.springframework.stereotype.Component;
@ -11,4 +16,8 @@ import org.springframework.stereotype.Component;
*/
@Component
public class EpmetPointOpenFeignClientFallback implements EpmetPointOpenFeignClient {
@Override
public Result<ResiPointDetailResultDTO> myPoint(TokenDto dto) {
return ModuleUtils.feignConError(ServiceConstant.RESI_PARTYMEMBER_SERVER, "myPoint", dto);
}
}

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

@ -1,8 +1,8 @@
version: "3.7"
services:
oper-crm-server:
epmet-point-server:
container_name: epmet-point-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.2
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.4
ports:
- "8112:8112"
network_mode: host # 使用现有网络

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

@ -1,6 +1,6 @@
version: "3.7"
services:
oper-crm-server:
epmet-point-server:
container_name: epmet-point-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-point-server:0.0.1
ports:

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

@ -1,6 +1,6 @@
version: "3.7"
services:
oper-crm-server:
epmet-point-server:
container_name: epmet-point-server-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-point-server:0.0.1
ports:

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.2</version>
<version>0.0.4</version>
<parent>
<artifactId>epmet-point</artifactId>
<groupId>com.epmet</groupId>

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

@ -1,8 +1,23 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.CustomerUserFormDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.result.CustomerUser4PointResultDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.PointAdjustmentResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.PointAdjustmentLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @description: 工作人员积分调整Controller
* @date: Created in 2020-07-20 16:38
@ -11,4 +26,48 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("work/adjustment")
public class AdjustmentController {
@Autowired
EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
PointAdjustmentLogService pointAdjustmentLogService;
/**
* @Description 调整积分时获取用户列表
* @param param
* @return
* @author wangc
* @date 2020.07.27 10:57
**/
@PostMapping("userlist")
public Result<List<CustomerUser4PointResultDTO>> userList(@RequestBody CustomerUserFormDTO param){
ValidatorUtils.validateEntity(param, CustomerUserFormDTO.CustomerIdGroup.class);
return epmetUserOpenFeignClient.customerUserList(param);
}
/**
* @Description 调整积分时获取用户详情
* @param param
* @return
* @author wangc
* @date 2020.07.27 11:15
**/
@PostMapping("userdetail")
public Result<CustomerUserDetailResultDTO> userDetail(@RequestBody IssueInitiatorFormDTO param){
ValidatorUtils.validateEntity(param,IssueInitiatorFormDTO.UserIdGroup.class);
return new Result<CustomerUserDetailResultDTO>().ok(pointAdjustmentLogService.userDetail(param));
}
/**
* @Description 根据UserId获取积分调整记录
* @param param :: getUserId
* @return
* @author wangc
* @date 2020.07.27 10:51
**/
@PostMapping("adjustrecord")
public Result<List<PointAdjustmentResultDTO>> adjustRecord(@RequestBody IssueInitiatorFormDTO param){
ValidatorUtils.validateEntity(param, IssueInitiatorFormDTO.UserIdGroup.class);
return new Result<List<PointAdjustmentResultDTO>>().ok(pointAdjustmentLogService.adjustRecord(param));
}
}

2
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ExchangeController.java

@ -11,4 +11,6 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("work/exchange")
public class ExchangeController {
}

122
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/ResiPointController.java

@ -1,7 +1,24 @@
package com.epmet.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.CommonPageUserFormDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.form.ResiPointRankFormDTO;
import com.epmet.dto.result.ResiPointDetailResultDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointRankListResultDTO;
import com.epmet.service.PointVerificationLogService;
import com.epmet.service.UserPointActionLogService;
import com.epmet.service.UserPointStatisticalDailyService;
import com.epmet.service.UserPointTotalService;
import com.epmet.utils.ModuleConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @description: 居民端积分信息controller
@ -11,4 +28,105 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("resi/point")
public class ResiPointController {
@Autowired
private UserPointTotalService userPointTotalService;
@Autowired
private UserPointStatisticalDailyService userPointStatisticalDailyService;
@Autowired
private PointVerificationLogService pointVerificationLogService;
@Autowired
private UserPointActionLogService pointActionLogService;
/**
* @Description 获取指定居民的积分信息
* @param dto
* @return
* @author wangc
* @date 2020.07.22 15:58
**/
@GetMapping("mypoint")
public Result<ResiPointDetailResultDTO> myPoint(@LoginUser TokenDto dto){
ResiCommonUserIdFormDTO param = new ResiCommonUserIdFormDTO();
param.setUserId(dto.getUserId());
ValidatorUtils.validateEntity(param,ResiCommonUserIdFormDTO.UserIdGroup.class);
return new Result<ResiPointDetailResultDTO>().ok(userPointTotalService.getMyPoint(param));
}
/**
* @Description 获取客户下用户积分排名榜
* @param dto
* @param pointRankFormDTO
* @return
* @author wangc
* @date 2020.07.22 16:13
**/
@PostMapping("rank")
public Result<List<ResiPointRankListResultDTO>> rank(@LoginUser TokenDto dto,@RequestBody ResiPointRankFormDTO pointRankFormDTO){
pointRankFormDTO.setUserId(dto.getUserId());
ValidatorUtils.validateEntity(pointRankFormDTO, ResiPointRankFormDTO.ResiPointRankGroup.class);
return new Result<List<ResiPointRankListResultDTO>>().ok(userPointTotalService.getPointRanking(pointRankFormDTO));
}
/**
* @Description 获取居民端周积分排行榜 还有当前用的信息
* @param dto
* @param pointRankFormDTO
* @return
* @author wangc
* @date 2020.07.21 16:57
**/
@PostMapping("weeklyrank")
public Result<List<ResiPointRankListResultDTO>> weeklyRank(@LoginUser TokenDto dto,@RequestBody ResiPointRankFormDTO pointRankFormDTO){
pointRankFormDTO.setUserId(dto.getUserId());
pointRankFormDTO.setTimeDimension(ModuleConstant.TIME_DIMENSION_WEEK);
ValidatorUtils.validateEntity(pointRankFormDTO, ResiPointRankFormDTO.ResiPointRankGroup.class);
return new Result<List<ResiPointRankListResultDTO>>().ok(userPointStatisticalDailyService.getPointRankWithinTimeZone(pointRankFormDTO));
}
/**
* @Description 获取居民端月积分排行榜 还有当前用的信息
* @param dto
* @param pointRankFormDTO
* @return
* @author wangc
* @date 2020.07.21 16:57
**/
@PostMapping("monthlyrank")
public Result<List<ResiPointRankListResultDTO>> monthlyRank(@LoginUser TokenDto dto,@RequestBody ResiPointRankFormDTO pointRankFormDTO){
pointRankFormDTO.setUserId(dto.getUserId());
pointRankFormDTO.setTimeDimension(ModuleConstant.TIME_DIMENSION_MONTH);
ValidatorUtils.validateEntity(pointRankFormDTO,ResiPointRankFormDTO.ResiPointRankGroup.class);
return new Result<List<ResiPointRankListResultDTO>>().ok(userPointStatisticalDailyService.getPointRankWithinTimeZone(pointRankFormDTO));
}
/**
* @Description 查找指定用户的积分记录
* @param dto
* @param pageUserParam
* @return
* @author wangc
* @date 2020.07.22 14:05
**/
@PostMapping("records")
public Result<List<ResiPointLogListResultDTO>> records(@LoginUser TokenDto dto,@RequestBody CommonPageUserFormDTO pageUserParam){
pageUserParam.setUserId(dto.getUserId());
ValidatorUtils.validateEntity(pageUserParam, CommonPageUserFormDTO.PageUserGroup.class);
return new Result<List<ResiPointLogListResultDTO>>().ok(pointActionLogService.getMyPointRecord(pageUserParam));
}
/**
* @Description 查找指定用户的积分兑换记录
* @param dto
* @param pageUserParam
* @return
* @author wangc
* @date 2020.07.22 14:05
**/
@PostMapping("exchangedrecord")
public Result<List<ResiPointLogListResultDTO>> exchangeRecord(@LoginUser TokenDto dto,@RequestBody CommonPageUserFormDTO pageUserParam){
pageUserParam.setUserId(dto.getUserId());
ValidatorUtils.validateEntity(pageUserParam,CommonPageUserFormDTO.PageUserGroup.class);
return new Result<List<ResiPointLogListResultDTO>>().ok(pointVerificationLogService.getMyExchangeRecord(pageUserParam));
}
}

46
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointAdjustmentLogDao.java

@ -0,0 +1,46 @@
/**
* 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.PointAdjustmentResultDTO;
import com.epmet.entity.PointAdjustmentLogEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-27
*/
@Mapper
public interface PointAdjustmentLogDao extends BaseDao<PointAdjustmentLogEntity> {
/**
* @Description 查询积分调整列表
* @param userId
* @return
* @author wangc
* @date 2020.07.27 10:44
**/
List<PointAdjustmentResultDTO> selectAdjustmentListByUserId(@Param("userId") String userId);
}

12
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationLogDao.java

@ -19,10 +19,12 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.dto.result.WorkPointVerificationLogResultDTO;
import com.epmet.entity.PointVerificationLogEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
@ -43,4 +45,14 @@ public interface PointVerificationLogDao extends BaseDao<PointVerificationLogEnt
**/
List<ResiPointLogPeriodResultDTO> selectVerificationLog(@Param("userId") String userId);
/**
* @Description 获取工作人员月度核销记录
* @param staffId
* @param startDate
* @param endDate
* @return
* @author wangc
* @date 2020.07.25 13:17
**/
List<WorkPointVerificationLogResultDTO> selectStaffVerificationLog(String staffId, Date startDate, Date endDate);
}

11
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointVerificationStatisticalDailyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.PointVerificationStatisticalDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 工作人员核销数据统计
@ -29,5 +30,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PointVerificationStatisticalDailyDao extends BaseDao<PointVerificationStatisticalDailyEntity> {
/**
* @Description 查询指定日期的工作人员核销积分是否存在
* @param createdBy
* @param dateId
* @return
* @author wangc
* @date 2020.07.27 17:37
**/
PointVerificationStatisticalDailyEntity selectIfExisted(@Param("createdBy") String createdBy, @Param("dateId") String dateId);
}

8
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointStatisticalDailyDao.java

@ -45,4 +45,12 @@ public interface UserPointStatisticalDailyDao extends BaseDao<UserPointStatistic
**/
List<ResiPointRankResultDTO> selectPointRankWithinTimeZone(@Param("customerId") String customerId,@Param("dimension") String dimension,@Param("dimensionId") String dimensionId);
/**
* @Description 查询有无指定日期的积分日统计
* @param userId
* @return
* @author wangc
* @date 2020.07.27 16:20
**/
UserPointStatisticalDailyEntity selectIfExisted(@Param("userId") String userId,@Param("dateId") String dateId,@Param("actionFlag")String actionFlag);
}

9
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/UserPointTotalDao.java

@ -53,4 +53,13 @@ public interface UserPointTotalDao extends BaseDao<UserPointTotalEntity> {
**/
List<ResiPointRankResultDTO> selectUserPointRank(@Param("customerId") String customerId);
/**
* @Description 根据userId查找是否存在数据
* @param userId
* @return
* @author wangc
* @date 2020.07.27 16:51
**/
UserPointTotalEntity selectIfExisted(@Param("userId") String userId);
}

76
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointAdjustmentLogEntity.java

@ -0,0 +1,76 @@
/**
* 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;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("point_adjustment_log")
public class PointAdjustmentLogEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 关联的积分动作Id
*/
private String actionId;
/**
* 调整人名称xx机关-xx
*/
private String operatorName;
/**
* 调整原因
*/
private String adjustReason;
/**
* 调整积分
*/
private Integer point;
/**
* plus/minus
*/
private String adjustmentType;
/**
* 调整人所属机关Id
*/
private String operatorAgencyId;
/**
* 居民Id
*/
private String userId;
}

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointVerificationLogEntity.java

@ -48,16 +48,6 @@ public class PointVerificationLogEntity extends BaseEpmetEntity {
*/
private String userId;
/**
* 核销对象首次注册网格
*/
private String userRegistedGridId;
/**
* 核销对象首次注册网格所在机关
*/
private String userRegistedAgnecyId;
/**
* 核销人员ID
*/

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

@ -0,0 +1,18 @@
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Description 积分缓存相关
* @ClassName PointRedis
* @Auth wangc
* @Date 2020-07-27 17:25
*/
@Component
public class PointRedis {
@Autowired
private RedisUtils redisUtils;
}

126
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointAdjustmentLogService.java

@ -0,0 +1,126 @@
/**
* 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.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PointAdjustmentLogDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.PointAdjustmentFormDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.PointAdjustmentResultDTO;
import com.epmet.entity.PointAdjustmentLogEntity;
import java.util.List;
import java.util.Map;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-27
*/
public interface PointAdjustmentLogService extends BaseService<PointAdjustmentLogEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PointAdjustmentLogDTO>
* @author generator
* @date 2020-07-27
*/
PageData<PointAdjustmentLogDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<PointAdjustmentLogDTO>
* @author generator
* @date 2020-07-27
*/
List<PointAdjustmentLogDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return PointAdjustmentLogDTO
* @author generator
* @date 2020-07-27
*/
PointAdjustmentLogDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-27
*/
void save(PointAdjustmentLogDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-27
*/
void update(PointAdjustmentLogDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-27
*/
void delete(String[] ids);
/**
* @Description 根据UserId获取积分调整记录
* @param param :: getUserId
* @return
* @author wangc
* @date 2020.07.27 10:51
**/
List<PointAdjustmentResultDTO> adjustRecord(IssueInitiatorFormDTO param);
/**
* @Description 用户详情
* @param param
* @return
* @author wangc
* @date 2020.07.27 10:57
**/
CustomerUserDetailResultDTO userDetail(IssueInitiatorFormDTO param);
/**
* @Description 积分调整
* @param param
* @return
* @author wangc
* @date 2020.07.27 13:52
**/
void adjustPoint(PointAdjustmentFormDTO param);
}

28
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationLogService.java

@ -20,8 +20,12 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PointVerificationLogDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.form.PointVerificationFormDTO;
import com.epmet.dto.form.WorkPointVerificationFormDTO;
import com.epmet.dto.result.PointVerificationResultDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.WorkPointVerficationListResultDTO;
import com.epmet.entity.PointVerificationLogEntity;
import java.util.List;
@ -97,10 +101,28 @@ public interface PointVerificationLogService extends BaseService<PointVerificati
/**
* @Description 查找指定用户的积分兑换记录
* @param userId
* @param pageUser
* @return
* @author wangc
* @date 2020.07.22 14:05
**/
List<ResiPointLogListResultDTO> getMyExchangeRecord(ResiCommonUserIdFormDTO userId);
List<ResiPointLogListResultDTO> getMyExchangeRecord(CommonPageUserFormDTO pageUser);
/**
* @Description 获取工作端积分核销记录
* @param verificationParam
* @return
* @author wangc
* @date 2020.07.24 16:08
**/
WorkPointVerficationListResultDTO getStaffVerificationRecordMonthly(WorkPointVerificationFormDTO verificationParam);
/**
* @Description 积分核销
* @param verificationParam
* @return
* @author wangc
* @date 2020.07.27 14:03
**/
PointVerificationResultDTO verifyPoint(PointVerificationFormDTO verificationParam);
}

9
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointVerificationStatisticalDailyService.java

@ -92,4 +92,13 @@ public interface PointVerificationStatisticalDailyService extends BaseService<Po
* @date 2020-07-20
*/
void delete(String[] ids);
/**
* @Description 新增或修改积分核销数据
* @param entity
* @return
* @author wangc
* @date 2020.07.27 17:28
**/
void insertOrUpdate(PointVerificationStatisticalDailyEntity entity);
}

7
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java

@ -20,7 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.entity.UserPointActionLogEntity;
@ -97,11 +97,12 @@ public interface UserPointActionLogService extends BaseService<UserPointActionLo
/**
* @Description 查找指定用户的积分记录
* @param userId
* @param pageUser
* @return
* @author wangc
* @date 2020.07.22 14:05
**/
List<ResiPointLogListResultDTO> getMyPointRecord(ResiCommonUserIdFormDTO userId);
List<ResiPointLogListResultDTO> getMyPointRecord(CommonPageUserFormDTO pageUser);
}

11
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointStatisticalDailyService.java

@ -102,5 +102,14 @@ public interface UserPointStatisticalDailyService extends BaseService<UserPointS
* @author wangc
* @date 2020.07.21 16:57
**/
ResiPointRankListResultDTO getPointRankWithinTimeZone(ResiPointRankFormDTO pointRankFormDTO);
List<ResiPointRankListResultDTO> getPointRankWithinTimeZone(ResiPointRankFormDTO pointRankFormDTO);
/**
* @Description 用户积分日统计新增或修改
* @param entity
* @return
* @author wangc
* @date 2020.07.27 16:10
**/
void insertOrUpdate(UserPointStatisticalDailyEntity entity);
}

31
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointTotalService.java

@ -20,6 +20,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.UserPointTotalDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.form.ResiPointRankFormDTO;
import com.epmet.dto.result.ResiPointDetailResultDTO;
import com.epmet.dto.result.ResiPointRankListResultDTO;
import com.epmet.entity.UserPointTotalEntity;
import java.util.List;
@ -92,4 +96,31 @@ public interface UserPointTotalService extends BaseService<UserPointTotalEntity>
* @date 2020-07-20
*/
void delete(String[] ids);
/**
* @Description 获取指定居民的积分信息
* @param userId
* @return
* @author wangc
* @date 2020.07.22 15:58
**/
ResiPointDetailResultDTO getMyPoint(ResiCommonUserIdFormDTO userId);
/**
* @Description 获取客户下用户积分排名榜
* @param pointRankFormDTO
* @return
* @author wangc
* @date 2020.07.22 16:13
**/
List<ResiPointRankListResultDTO> getPointRanking(ResiPointRankFormDTO pointRankFormDTO);
/**
* @Description 新增或修改用户总积分记录
* @param entity
* @return
* @author wangc
* @date 2020.07.27 16:45
**/
void insertOrUpdate(UserPointTotalEntity entity);
}

242
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointAdjustmentLogServiceImpl.java

@ -0,0 +1,242 @@
/**
* 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.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.PointAdjustmentLogDao;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.PointAdjustmentLogDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.PointAdjustmentFormDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.PointAdjustmentResultDTO;
import com.epmet.dto.result.ResiPointDetailResultDTO;
import com.epmet.dto.result.StaffEtAgencyResultDTO;
import com.epmet.entity.PointAdjustmentLogEntity;
import com.epmet.entity.UserPointActionLogEntity;
import com.epmet.entity.UserPointStatisticalDailyEntity;
import com.epmet.entity.UserPointTotalEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.PointAdjustmentLogService;
import com.epmet.service.UserPointStatisticalDailyService;
import com.epmet.service.UserPointTotalService;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-27
*/
@Service
public class PointAdjustmentLogServiceImpl extends BaseServiceImpl<PointAdjustmentLogDao, PointAdjustmentLogEntity> implements PointAdjustmentLogService {
@Autowired
EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
UserPointTotalService userPointTotalService;
@Autowired
UserPointActionLogDao userPointActionLogDao;
@Autowired
UserPointStatisticalDailyService userPointStatisticalDailyService;
@Autowired
PointAdjustmentLogDao pointAdjustmentLogDao;
@Override
public PageData<PointAdjustmentLogDTO> page(Map<String, Object> params) {
IPage<PointAdjustmentLogEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PointAdjustmentLogDTO.class);
}
@Override
public List<PointAdjustmentLogDTO> list(Map<String, Object> params) {
List<PointAdjustmentLogEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PointAdjustmentLogDTO.class);
}
private QueryWrapper<PointAdjustmentLogEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PointAdjustmentLogEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public PointAdjustmentLogDTO get(String id) {
PointAdjustmentLogEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, PointAdjustmentLogDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PointAdjustmentLogDTO dto) {
PointAdjustmentLogEntity entity = ConvertUtils.sourceToTarget(dto, PointAdjustmentLogEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PointAdjustmentLogDTO dto) {
PointAdjustmentLogEntity entity = ConvertUtils.sourceToTarget(dto, PointAdjustmentLogEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 根据UserId获取积分调整记录
* @param param :: getUserId
* @return
* @author wangc
* @date 2020.07.27 10:51
**/
@Override
public List<PointAdjustmentResultDTO> adjustRecord(IssueInitiatorFormDTO param) {
return baseDao.selectAdjustmentListByUserId(param.getUserId());
}
/**
* @Description 用户详情
* @param param
* @return
* @author wangc
* @date 2020.07.27 10:57
**/
@Override
public CustomerUserDetailResultDTO userDetail(IssueInitiatorFormDTO param) {
Result<CustomerUserDetailResultDTO> detailResult = epmetUserOpenFeignClient.customerUserDetail(param);
if(!detailResult.success()){
throw new RenException(detailResult.getCode());
}
ResiCommonUserIdFormDTO userParam = ConvertUtils.sourceToTarget(param,ResiCommonUserIdFormDTO.class);
ResiPointDetailResultDTO pointDto = userPointTotalService.getMyPoint(userParam);
if(null != detailResult.getData()){
CustomerUserDetailResultDTO result = new CustomerUserDetailResultDTO();
result.setPoint(null != pointDto ? pointDto.getUsablePoint() : NumConstant.ZERO);
}
detailResult.getData().setPoint(null != pointDto ? pointDto.getUsablePoint() : NumConstant.ZERO);
return detailResult.getData();
}
/**
* @Description 积分调整
* @param param
* @return
* @author wangc
* @date 2020.07.27 13:52
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void adjustPoint(PointAdjustmentFormDTO param) {
if(null == param.getPoint()) throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
Date currentTime = new Date();
Integer point = param.getPoint();
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,param.getAdjustmentType())){
if(point > NumConstant.ZERO){
point *= NumConstant.ONE_NEG;
}
}else{
if(point < NumConstant.ZERO){
point *= NumConstant.ONE_NEG;
}
}
//0.工作人员基本信息[agencyId 昵称]
IssueInitiatorFormDTO staffParam = new IssueInitiatorFormDTO();
staffParam.setUserId(param.getOperatorId());
Result<StaffEtAgencyResultDTO> staffResult =
epmetUserOpenFeignClient.staffMsg(staffParam);
String agencyId = ModuleConstant.EMPTY_STR;
String operatorName = ModuleConstant.EMPTY_STR;
if(staffResult.success() && null != staffResult.getData()){
agencyId = staffResult.getData().getAgencyId();
operatorName = staffResult.getData().getNickname();
}
//1.记录用户积分行为记录表
UserPointActionLogEntity userPointActionEntity = new UserPointActionLogEntity();
userPointActionEntity.setUserId(param.getUserId());
userPointActionEntity.setCustomerId(param.getCustomerId());
userPointActionEntity.setActionFlag(param.getAdjustmentType());
userPointActionEntity.setPoint(point);
userPointActionEntity.setEventStatement(param.getReason());
userPointActionEntity.setEventName(ModuleConstant.EVENT_NAME_ADJUSTMENT);
userPointActionEntity.setOperatorAgencyId(agencyId);
userPointActionLogDao.insert(userPointActionEntity);
//2.记录积分调整记录表
PointAdjustmentLogEntity adjustmentEntity = new PointAdjustmentLogEntity();
adjustmentEntity.setActionId(userPointActionEntity.getId());
adjustmentEntity.setOperatorName(operatorName);
adjustmentEntity.setAdjustReason(param.getReason());
adjustmentEntity.setAdjustmentType(param.getAdjustmentType());
adjustmentEntity.setPoint(point);
adjustmentEntity.setOperatorAgencyId(agencyId);
adjustmentEntity.setUserId(param.getUserId());
//此处设置无效,会拦截到当前请求token中的userId,实际与这里的operatorId一致
adjustmentEntity.setCreatedBy(param.getOperatorId());
pointAdjustmentLogDao.insert(adjustmentEntity);
//3.新增或更新用户积分日统计表
DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(currentTime);
UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dim,UserPointStatisticalDailyEntity.class);
statistical.setUserId(param.getUserId());
statistical.setActionFlag(param.getAdjustmentType());
statistical.setCustomerId(param.getCustomerId());
statistical.setPointChange(point);
userPointStatisticalDailyService.insertOrUpdate(statistical);
//4.更新用户积分总表
UserPointTotalEntity total = new UserPointTotalEntity();
total.setUserId(param.getUserId());
total.setCustomerId(param.getCustomerId());
//增量
total.setUsedPoint(NumConstant.ZERO);
total.setUsablePoint(point);
total.setTotalPoint(point);
userPointTotalService.insertOrUpdate(total);
}
}

3
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

@ -115,6 +115,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
log.error("list ruleId:{} have not pointUnit or pointNum,pointRule:{}", JSON.toJSONString(pointRuleEntity));
return null;
}
resultDTO.setEnabledFlag(NumConstant.ONE_STR.equals(pointRuleEntity.getEnabledFlag()) ? true : false);
resultDTO.setPointValue(pointRuleEntity.getPoint().toString().concat("分").concat(StrConstant.SEPARATOR).concat(pointUnitEnum.getDesc()));
return resultDTO;
}).filter(fun -> fun != null).collect(Collectors.toList());
@ -129,7 +130,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
}
PointDetailResultDTO resultDTO = ConvertUtils.sourceToTarget(pointRuleEntity, PointDetailResultDTO.class);
resultDTO.setRuleId(pointRuleEntity.getId());
resultDTO.setEnabledFlag(NumConstant.ONE_STR.equals(pointRuleEntity.getEnabledFlag()) ? "true" : "false");
resultDTO.setEnabledFlag(NumConstant.ONE_STR.equals(pointRuleEntity.getEnabledFlag()) ? true : false);
return resultDTO;
}

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

@ -20,25 +20,42 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.PointVerificationLogDao;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.PointVerificationLogDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.entity.PointVerificationLogEntity;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.PointRedis;
import com.epmet.service.PointVerificationLogService;
import com.epmet.service.PointVerificationStatisticalDailyService;
import com.epmet.service.UserPointStatisticalDailyService;
import com.epmet.service.UserPointTotalService;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -50,6 +67,22 @@ import java.util.stream.Collectors;
@Service
public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerificationLogDao, PointVerificationLogEntity> implements PointVerificationLogService {
protected final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private UserPointTotalService userPointTotalService;
@Autowired
private PointVerificationLogDao pointVerificationLogDao;
@Autowired
private PointVerificationStatisticalDailyService pointVerificationStatisticalDailyService;
@Autowired
PointRedis pointRedis;
@Autowired
private UserPointActionLogDao userPointActionLogDao;
@Autowired
private UserPointStatisticalDailyService userPointStatisticalDailyService;
@Override
public PageData<PointVerificationLogDTO> page(Map<String, Object> params) {
IPage<PointVerificationLogEntity> page = baseDao.selectPage(
@ -104,14 +137,15 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
/**
* @Description 查找指定用户的积分兑换记录
* @param userId
* @param pageUser
* @return
* @author wangc
* @date 2020.07.22 14:05
**/
@Override
public List<ResiPointLogListResultDTO> getMyExchangeRecord(ResiCommonUserIdFormDTO userId) {
List<ResiPointLogPeriodResultDTO> logList = baseDao.selectVerificationLog(userId.getUserId());
public List<ResiPointLogListResultDTO> getMyExchangeRecord(CommonPageUserFormDTO pageUser) {
PageHelper.startPage(pageUser.getPageNo(),pageUser.getPageSize());
List<ResiPointLogPeriodResultDTO> logList = baseDao.selectVerificationLog(pageUser.getUserId());
List<ResiPointLogListResultDTO> result = new LinkedList<>();
if(null != logList && !logList.isEmpty()){
Map<String,List<ResiPointLogPeriodResultDTO>> map =
@ -130,4 +164,204 @@ public class PointVerificationLogServiceImpl extends BaseServiceImpl<PointVerifi
return result;
}
/**
* @Description 获取工作端积分核销记录
* @param verificationParam
* @return
* @author wangc
* @date 2020.07.24 16:08
**/
@Override
public WorkPointVerficationListResultDTO getStaffVerificationRecordMonthly(WorkPointVerificationFormDTO verificationParam) {
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN);
if(StringUtils.isNotBlank(verificationParam.getTimeParam()) && verificationParam.getTimeParam().matches(ModuleConstant.MONTH_REG)){
verificationParam.setTimeParam(new StringBuilder(verificationParam.getTimeParam()).append(ModuleConstant.DATE_COMPLEMENT).toString());
}else{
verificationParam.setTimeParam(format.format(new Date()));
}
WorkPointVerficationListResultDTO result = new WorkPointVerficationListResultDTO();
result.setTotalPoint(NumConstant.ZERO);
List<WorkPointVerificationDetailResultDTO> resultObj = new LinkedList<>();
try{
Date date = format.parse(verificationParam.getTimeParam());
List<WorkPointVerificationLogResultDTO> dataList =
baseDao.selectStaffVerificationLog(verificationParam.getStaffId(),getFirstDayDateOfMonth(date),getLastDayOfMonth(date));
result.setTotalPoint(
dataList.stream().mapToInt(o -> o.getPoint()).sum()
);
List<String> userIds = dataList.stream().map(data -> data.getUserId()).collect(Collectors.toList());
Result<List<UserBaseInfoResultDTO>> userInfo =
epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
boolean userRequestCallback = userInfo.success() && null != userInfo.getData() && !userInfo.getData().isEmpty();
for(int i = NumConstant.ZERO ; i < dataList.size() ; i++){
WorkPointVerificationDetailResultDTO o = new WorkPointVerificationDetailResultDTO();
o.setPoint(new StringBuilder("-").append(dataList.get(i).getPoint().toString()).toString());
o.setRemark(dataList.get(i).getRemark());
if(userRequestCallback) {
//如果是陌生人显示微信昵称
o.setUserNickname(userInfo.getData().get(i) == null ? ModuleConstant.EMPTY_STR : (StringUtils.isBlank(userInfo.getData().get(i).getShowName()) ? userInfo.getData().get(i).getNickname() : userInfo.getData().get(i).getShowName()));
}
resultObj.add(o);
}
}catch (Exception e){
logger.error(String.format(ModuleConstant.DATE_TRANSLATION_ERROR,e.getMessage()));
}
result.setCheckingList(resultObj);
return result;
}
/**
* @Description 积分核销
* @param verificationParam
* @return
* @author wangc
* @date 2020.07.27 14:03
**/
@Override
@Transactional(rollbackFor = Exception.class)
public PointVerificationResultDTO verifyPoint(PointVerificationFormDTO verificationParam) {
Date currentTime = new Date();
PointVerificationResultDTO result = new PointVerificationResultDTO();
ResiCommonUserIdFormDTO userId = new ResiCommonUserIdFormDTO();
userId.setUserId(verificationParam.getUserId());
ResiPointDetailResultDTO currentPoint = userPointTotalService.getMyPoint(userId);
if(null == currentPoint || null == currentPoint.getUsablePoint() || currentPoint.getUsablePoint() < verificationParam.getPoint()){
result.setSuccessFlag(false);
result.setFailureReason(ModuleConstant.POINT_NOT_ENOUGH);
return result;
}
IssueInitiatorFormDTO staffId = new IssueInitiatorFormDTO();
staffId.setUserId(verificationParam.getOperatorId());
Result<StaffEtAgencyResultDTO> staffResult =
epmetUserOpenFeignClient.staffMsg(staffId);
//保证积分为负数,因为是积分核销,只有在积分核销日统计和积分核销日志里存储正数
Integer point = verificationParam.getPoint();
if(point > NumConstant.ZERO){
point *= NumConstant.ONE_NEG;
}
String customerId = ModuleConstant.EMPTY_STR;
String agencyId = ModuleConstant.EMPTY_STR;
String operatorName = ModuleConstant.EMPTY_STR;
PointVerificationStatisticalDailyEntity statistical = new PointVerificationStatisticalDailyEntity();
if(staffResult.success() && null != staffResult.getData()){
statistical = ConvertUtils.sourceToTarget(staffResult.getData(),PointVerificationStatisticalDailyEntity.class);
customerId = staffResult.getData().getCustomerId();
operatorName = staffResult.getData().getNickname();
agencyId = staffResult.getData().getAgencyId();
}
//1.记录积分行为日志 - 居民端
UserPointActionLogEntity action = new UserPointActionLogEntity();
action.setCreatedBy(verificationParam.getOperatorId());
action.setUserId(verificationParam.getUserId());
action.setActionFlag(ModuleConstant.OPERATION_TYPE_MINUS);
action.setEventName(ModuleConstant.EVENT_NAME_EXCHANGE);
action.setEventStatement(verificationParam.getRemark());
action.setPoint(point);
userPointActionLogDao.insert(action);
//2.记录积分核销日志表
PointVerificationLogEntity verificationLog = new PointVerificationLogEntity();
verificationLog.setActionId(action.getId());
verificationLog.setUserId(verificationParam.getUserId());
verificationLog.setOperatorId(verificationParam.getOperatorId());
verificationLog.setOperatorName(operatorName);
verificationLog.setOperatorAgencyId(agencyId);
verificationLog.setExchangedItem(verificationParam.getRemark());
verificationLog.setPoint(point * NumConstant.ONE_NEG);
verificationLog.setLongitude(verificationParam.getLongitude());
verificationLog.setDimension(verificationParam.getDimension());
verificationLog.setAddress(verificationParam.getAddress());
pointVerificationLogDao.insert(verificationLog);
//3.记录积分日统计表
DimIdGenerator.DimIdBean dim = DimIdGenerator.getDimIdBean(currentTime);
UserPointStatisticalDailyEntity userStatistical = ConvertUtils.sourceToTarget(dim,UserPointStatisticalDailyEntity.class);
userStatistical.setUserId(verificationParam.getUserId());
userStatistical.setActionFlag(ModuleConstant.OPERATION_TYPE_EXCHANGE);
userStatistical.setCustomerId(customerId);
userStatistical.setPointChange(point);
userPointStatisticalDailyService.insertOrUpdate(userStatistical);
//4.记录积分核销日统计 - 政府端
statistical.setVerificatedPoint(point * NumConstant.ONE_NEG);
pointVerificationStatisticalDailyService.insertOrUpdate(statistical);
//5.更新用户总积分表
UserPointTotalEntity userPoint = new UserPointTotalEntity();
userPoint.setUserId(verificationParam.getUserId());
userPoint.setCustomerId(customerId);
//负数
userPoint.setTotalPoint(point);
//负数
userPoint.setUsablePoint(point);
//正数
userPoint.setUsedPoint(point * NumConstant.ONE_NEG);
userPointTotalService.insertOrUpdate(userPoint);
//6.将核销结果记录redis(List) key -> [epmet:point:verification:userId] lpush #新元素插入表头 lindex key 0 #表头
result.setSuccessFlag(true);
List<String> userParam = new LinkedList<>();
userParam.add(verificationParam.getUserId());
Result<List<UserBaseInfoResultDTO>> userResult =
epmetUserOpenFeignClient.queryUserBaseInfo(userParam);
String userHeadPhoto = ModuleConstant.EMPTY_STR;
String userNickname = ModuleConstant.EMPTY_STR;
if(userResult.success() && null != userResult.getData() && !userResult.getData().isEmpty()){
userHeadPhoto = userResult.getData().get(NumConstant.ZERO).getHeadImgUrl();
userNickname = userResult.getData().get(NumConstant.ZERO).getShowName();
}
result.setUserHeadPhoto(userHeadPhoto);
result.setUserNickname(userNickname);
return result;
}
/**
* @Description 得到指定日所在月第一天
* @param date
* @return
* @author wangc
* @date 2020.07.27 17:21
**/
private static Date getFirstDayDateOfMonth(final Date date) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
final int last = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, last);
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(cal.getTimeInMillis()), ZoneId.systemDefault());
LocalDateTime startOfDay = localDateTime.with(LocalTime.MIN);
return Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* @Description 得到指定日所在月最后一天
* @param date
* @return
* @author wangc
* @date 2020.07.27 17:21
**/
public static Date getLastDayOfMonth(final Date date) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
final int last = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, last);
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(cal.getTimeInMillis()), ZoneId.systemDefault());;
LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX);
return Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant());
}
}

18
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointVerificationStatisticalDailyServiceImpl.java

@ -97,4 +97,22 @@ public class PointVerificationStatisticalDailyServiceImpl extends BaseServiceImp
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 新增或修改积分核销数据
* @param entity
* @return
* @author wangc
* @date 2020.07.27 17:28
**/
@Override
public void insertOrUpdate(PointVerificationStatisticalDailyEntity entity) {
PointVerificationStatisticalDailyEntity existed = baseDao.selectIfExisted(entity.getCreatedBy(),entity.getDateId());
if(null != existed && StringUtils.isNotBlank(existed.getId())){
existed.setVerificatedPoint(null == existed.getVerificatedPoint() ? entity.getVerificatedPoint() : existed.getVerificatedPoint() + entity.getVerificatedPoint());
updateById(existed);
}else{
insert(entity);
}
}
}

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

@ -25,11 +25,12 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.UserPointActionLogDao;
import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
import com.epmet.dto.result.ResiPointLogListResultDTO;
import com.epmet.dto.result.ResiPointLogPeriodResultDTO;
import com.epmet.entity.UserPointActionLogEntity;
import com.epmet.service.UserPointActionLogService;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -102,14 +103,15 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
/**
* @Description 查找指定用户的积分记录
* @param userId
* @param pageUser
* @return
* @author wangc
* @date 2020.07.22 14:05
**/
@Override
public List<ResiPointLogListResultDTO> getMyPointRecord(ResiCommonUserIdFormDTO userId) {
List<ResiPointLogPeriodResultDTO> logList = baseDao.selectPointActionLogList(userId.getUserId());
public List<ResiPointLogListResultDTO> getMyPointRecord(CommonPageUserFormDTO pageUser) {
PageHelper.startPage(pageUser.getPageNo(),pageUser.getPageSize());
List<ResiPointLogPeriodResultDTO> logList = baseDao.selectPointActionLogList(pageUser.getUserId());
List<ResiPointLogListResultDTO> result = new LinkedList<>();
if(null != logList && !logList.isEmpty()){
Map<String,List<ResiPointLogPeriodResultDTO>> map =

113
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointStatisticalDailyServiceImpl.java

@ -20,23 +20,31 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.UserPointStatisticalDailyDao;
import com.epmet.dto.UserPointStatisticalDailyDTO;
import com.epmet.dto.form.ResiPointRankFormDTO;
import com.epmet.dto.result.ResiPointRankListResultDTO;
import com.epmet.dto.result.ResiPointRankResultDTO;
import com.epmet.dto.result.ResiPointRankingResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.UserPointStatisticalDailyEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.UserPointStatisticalDailyService;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 用户积分统计情况
@ -47,6 +55,8 @@ import java.util.Map;
@Service
public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPointStatisticalDailyDao, UserPointStatisticalDailyEntity> implements UserPointStatisticalDailyService {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public PageData<UserPointStatisticalDailyDTO> page(Map<String, Object> params) {
@ -108,13 +118,100 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo
* @date 2020.07.21 16:57
**/
@Override
public ResiPointRankListResultDTO getPointRankWithinTimeZone(ResiPointRankFormDTO pointRankFormDTO) {
//默认查周数据
if(StringUtils.isBlank(pointRankFormDTO.getTimeDimension())) {
pointRankFormDTO.setTimeDimension(ModuleConstant.TIME_ZONE_WEEK);
public List<ResiPointRankListResultDTO> getPointRankWithinTimeZone(ResiPointRankFormDTO pointRankFormDTO) {
List<ResiPointRankListResultDTO> result = new LinkedList<>();
ResiPointRankListResultDTO o = new ResiPointRankListResultDTO();
//需要参数 Id 维度值 维度标识
//1.获取当前用户昵称以及当前用户所属客户Id
List<String> userIdParam = new LinkedList<>();
userIdParam.add(pointRankFormDTO.getUserId());
Result<List<UserBaseInfoResultDTO>> myResiInfoResult =
epmetUserOpenFeignClient.queryUserBaseInfo(userIdParam);
if(myResiInfoResult.success() && null != myResiInfoResult.getData() && !myResiInfoResult.getData().isEmpty()){
if(StringUtils.isBlank(pointRankFormDTO.getCustomerId())) {
//缓存中陌生人游客也有对应的customerId
pointRankFormDTO.setCustomerId(myResiInfoResult.getData().get(NumConstant.ZERO).getCustomerId());
}
//微信昵称
o.setMyNickname(myResiInfoResult.getData().get(NumConstant.ZERO).getNickname());
}
//2.获取维度值
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(new Date());
String dimVal = StringUtils.equals(ModuleConstant.TIME_ZONE_WEEK,pointRankFormDTO.getTimeDimension()) ? dimIdBean.getWeekId() : dimIdBean.getMonthId();
//3.查询排行榜信息,个人排行(分页)
if(NumConstant.ONE < pointRankFormDTO.getPageNo()){
PageHelper.startPage(pointRankFormDTO.getPageNo(),pointRankFormDTO.getPageSize());
}
List<ResiPointRankResultDTO> rankList =
baseDao.selectPointRankWithinTimeZone(pointRankFormDTO.getCustomerId(),pointRankFormDTO.getTimeDimension(),dimVal);
if(null == rankList || rankList.isEmpty()){
o.setMyPoint(NumConstant.ZERO);
o.setMyRanking(NumConstant.ZERO);
return result;
}
//如果请求的是第一页
if(NumConstant.ONE == pointRankFormDTO.getPageNo()) {
ResiPointRankResultDTO myself =
rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst().get();
if (null != myself) {
o.setMyPoint(myself.getTotalPoint());
o.setMyRanking(myself.getRank());
} else {
o.setMyPoint(NumConstant.ZERO);
if (rankList.get(rankList.size() - NumConstant.ONE).getTotalPoint() > NumConstant.ZERO) {
o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank() + NumConstant.ONE);
} else {
o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank());
}
}
int fromIndex = pointRankFormDTO.getPageNo() * pointRankFormDTO.getPageSize();
int toIndex = (pointRankFormDTO.getPageNo() + 1) * pointRankFormDTO.getPageSize();
if(toIndex > rankList.size()) {
toIndex = rankList.size();
}
rankList = rankList.subList(fromIndex,toIndex);
}
List<String> userIds = rankList.stream().map(ResiPointRankResultDTO::getUserId).collect(Collectors.toList());
//查询用户昵称
Result<List<UserBaseInfoResultDTO>> userInfo =
epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
boolean userRequestCallback = userInfo.success() && null != userInfo.getData() && !userInfo.getData().isEmpty();
for (int i = NumConstant.ZERO; i < rankList.size(); i++) {
ResiPointRankListResultDTO resultObj = ConvertUtils.sourceToTarget(o,ResiPointRankListResultDTO.class);
ResiPointRankingResultDTO target = new ResiPointRankingResultDTO();
target.setRanking(rankList.get(i).getRank());
target.setPoint(rankList.get(i).getTotalPoint());
if(userRequestCallback) {
target.setNickname(null == userInfo.getData().get(i) ? "" : userInfo.getData().get(i).getNickname());
}
resultObj.setRankList(target);
result.add(resultObj);
}
return result;
}
return null;
/**
* @Description 用户积分日统计新增或修改
* @param entity
* @return
* @author wangc
* @date 2020.07.27 16:10
**/
@Override
public void insertOrUpdate(UserPointStatisticalDailyEntity entity) {
UserPointStatisticalDailyEntity existed = baseDao.selectIfExisted(entity.getUserId(),entity.getDateId(),entity.getActionFlag());
if(null != existed && StringUtils.isNotBlank(existed.getId())){
existed.setPointChange(null == existed.getPointChange() ? entity.getPointChange() : existed.getPointChange() + entity.getPointChange());
updateById(existed);
}else{
insert(entity);
}
}
}

137
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointTotalServiceImpl.java

@ -20,20 +20,30 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.UserPointTotalDao;
import com.epmet.dto.UserPointTotalDTO;
import com.epmet.dto.form.ResiCommonUserIdFormDTO;
import com.epmet.dto.form.ResiPointRankFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.UserPointTotalEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.UserPointTotalService;
import com.epmet.utils.DimIdGenerator;
import com.epmet.utils.ModuleConstant;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 用户积分总计
@ -44,6 +54,8 @@ import java.util.Map;
@Service
public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao, UserPointTotalEntity> implements UserPointTotalService {
@Autowired
EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public PageData<UserPointTotalDTO> page(Map<String, Object> params) {
@ -97,4 +109,123 @@ public class UserPointTotalServiceImpl extends BaseServiceImpl<UserPointTotalDao
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @Description 获取指定居民的积分信息
* @param userId
* @return
* @author wangc
* @date 2020.07.22 15:58
**/
@Override
public ResiPointDetailResultDTO getMyPoint(ResiCommonUserIdFormDTO userId) {
return baseDao.selectPointByUserId(userId.getUserId());
}
/**
* @Description 获取客户下用户积分排名榜
* @param pointRankFormDTO
* @return
* @author wangc
* @date 2020.07.22 16:13
**/
@Override
public List<ResiPointRankListResultDTO> getPointRanking(ResiPointRankFormDTO pointRankFormDTO) {
List<ResiPointRankListResultDTO> result = new LinkedList<>();
ResiPointRankListResultDTO o = new ResiPointRankListResultDTO();
//1.获取当前用户昵称以及当前用户所属客户Id
List<String> userIdParam = new LinkedList<>();
userIdParam.add(pointRankFormDTO.getUserId());
Result<List<UserBaseInfoResultDTO>> myResiInfoResult =
epmetUserOpenFeignClient.queryUserBaseInfo(userIdParam);
if(myResiInfoResult.success() && null != myResiInfoResult.getData() && !myResiInfoResult.getData().isEmpty()){
if(StringUtils.isBlank(pointRankFormDTO.getCustomerId())) {
pointRankFormDTO.setCustomerId(myResiInfoResult.getData().get(NumConstant.ZERO).getCustomerId());
}
//微信昵称
o.setMyNickname(myResiInfoResult.getData().get(NumConstant.ZERO).getNickname());
}
//2.查询排行榜信息,个人排行(分页)
if(NumConstant.ONE < pointRankFormDTO.getPageNo()){
PageHelper.startPage(pointRankFormDTO.getPageNo(),pointRankFormDTO.getPageSize());
}
//排行榜
List<ResiPointRankResultDTO> rankList =
baseDao.selectUserPointRank(pointRankFormDTO.getCustomerId());
//当排行榜没有数据时
if(null == rankList || rankList.isEmpty()){
o.setMyPoint(NumConstant.ZERO);
o.setMyRanking(NumConstant.ZERO);
result.add(o);
return result;
}
//如果当前请求不是第一页
if(NumConstant.ONE == pointRankFormDTO.getPageNo()) {
ResiPointRankResultDTO myself =
rankList.stream().filter(obj -> StringUtils.equals(obj.getUserId(), pointRankFormDTO.getUserId())).findFirst().get();
if (null != myself) {
o.setMyPoint(myself.getTotalPoint());
o.setMyRanking(myself.getRank());
} else {
if (rankList.get(rankList.size() - NumConstant.ONE).getTotalPoint() > NumConstant.ZERO) {
o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank() + NumConstant.ONE);
} else {
o.setMyRanking(rankList.get(rankList.size() - NumConstant.ONE).getRank());
}
}
int fromIndex = pointRankFormDTO.getPageNo() * pointRankFormDTO.getPageSize();
int toIndex = (pointRankFormDTO.getPageNo() + 1) * pointRankFormDTO.getPageSize();
if(toIndex > rankList.size()) {
toIndex = rankList.size();
}
//将假分页结果替换到rankList
rankList = rankList.subList(fromIndex,toIndex);
}
List<String> userIds = rankList.stream().map(ResiPointRankResultDTO::getUserId).collect(Collectors.toList());
//查询用户昵称
Result<List<UserBaseInfoResultDTO>> userInfo =
epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
boolean userRequestCallback = userInfo.success() && null != userInfo.getData() && !userInfo.getData().isEmpty();
for (int i = NumConstant.ZERO; i < rankList.size(); i++) {
ResiPointRankListResultDTO resultObj = ConvertUtils.sourceToTarget(o,ResiPointRankListResultDTO.class);
ResiPointRankingResultDTO target = new ResiPointRankingResultDTO();
target.setRanking(rankList.get(i).getRank());
target.setPoint(rankList.get(i).getTotalPoint());
if(userRequestCallback) {
target.setNickname(null == userInfo.getData().get(i) ? "" : userInfo.getData().get(i).getNickname());
}
resultObj.setRankList(target);
result.add(resultObj);
}
return result;
}
/**
* @Description 新增或修改用户总积分记录
* @param entity
* @return
* @author wangc
* @date 2020.07.27 16:45
**/
@Override
public void insertOrUpdate(UserPointTotalEntity entity) {
UserPointTotalEntity existed = baseDao.selectIfExisted(entity.getUserId());
if(null != existed && StringUtils.isBlank(existed.getId())){
existed.setUsedPoint(null == existed.getUsedPoint() ? entity.getUsedPoint() : entity.getUsedPoint() + existed.getUsedPoint());
existed.setUsablePoint(null == existed.getUsablePoint() ? entity.getUsablePoint() : entity.getUsablePoint() + existed.getUsablePoint());
existed.setTotalPoint(null == existed.getTotalPoint() ? entity.getTotalPoint() : entity.getTotalPoint() + existed.getTotalPoint());
updateById(existed);
}else{
insert(entity);
}
}
}

91
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/utils/DimIdGenerator.java

@ -0,0 +1,91 @@
package com.epmet.utils;
import com.epmet.commons.tools.utils.DateUtils;
import lombok.Data;
import java.util.Calendar;
import java.util.Date;
public class DimIdGenerator {
/**
* 生成日期维度ID
* @param targetDate
* @return
*/
public static String getDateDimId(Date targetDate) {
return DateUtils.format(targetDate, DateUtils.DATE_PATTERN_YYYYMMDD);
}
/**
* 获取月维度ID
* @param date
* @return
*/
public static String getMonthDimId(Date date) {
return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYYMM);
}
/**
* 获取周维度ID ,每周的星期一为 周的开始
* @param date
* @return
*/
public static String getWeekDimId(Date date) {
String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY);
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
calendar.setTime(date);
return yyyy.concat("W").concat(calendar.get(Calendar.WEEK_OF_YEAR)+"");
}
/**
* 获取季度维度ID
* @param date
* @return
*/
public static String getQuarterDimId(Date date) {
String yyyy = DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY);
return yyyy.concat("Q").concat(DateUtils.getQuarterIndex(date) + "");
}
/**
* 获取年维度ID
* @param date
* @return
*/
public static String getYearDimId(Date date) {
return DateUtils.format(date, DateUtils.DATE_PATTERN_YYYY);
}
/**
* 获取封装了所有ID的对象
* @return
*/
public static DimIdBean getDimIdBean(Date date) {
DimIdBean dimIdBean = new DimIdBean();
dimIdBean.setDateId(getDateDimId(date));
dimIdBean.setMonthId(getMonthDimId(date));
dimIdBean.setWeekId(getWeekDimId(date));
dimIdBean.setQuarterId(getQuarterDimId(date));
dimIdBean.setYearId(getYearDimId(date));
return dimIdBean;
}
public static void main(String[] args) {
DimIdBean dimIdBean = getDimIdBean(DateUtils.stringToDate("2020-06-14",DateUtils.DATE_PATTERN));
System.out.println(dimIdBean);
}
@Data
public static class DimIdBean {
private String dateId;
private String monthId;
private String quarterId;
private String yearId;
private String weekId;
public DimIdBean() {
}
}
}

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

@ -20,31 +20,74 @@ public interface ModuleConstant extends Constant {
/**
* 正则表达式 日期 严格按照yyyy-MM-dd格式匹配
* */
*/
String DATE_REG = "^([1-9]\\d{3}-)([0-1][1-9]-)(([0-3]{0,1}[0-9]))$";
/**
* 正则表达式 严格按照yyyyWcc格式匹配
* */
*/
String WEEK_REG = "^([1-9]\\d{3}W)(([0-4][1-9])|50|51|52)";
/**
* 正则表达式 月份 严格按照yyyy-MM格式匹配
* */
*/
String MONTH_REG = "^([1-9]\\d{3}-)(([0][1-9])|10|11|12)";
/**
* 兑换记录标题
* */
*/
String TITLE_EXCHANGE_POINT = "积分兑换";
/**
* 按周排行
* */
*/
String TIME_ZONE_WEEK = "week";
/**
* 按月排行
* */
*/
String TIME_ZONE_MONTH = "month";
/**
* 给传参 yyyy-MM形式补全日期
*/
String DATE_COMPLEMENT = "-01";
/**
* 日期转换格式异常
*/
String DATE_TRANSLATION_ERROR = "日期转换格式异常 -> 【%s】";
/**
* 时间维度
*/
String TIME_DIMENSION_WEEK = "week";
/**
* 时间维度
*/
String TIME_DIMENSION_MONTH = "month";
/**
*
*/
String OPERATION_TYPE_MINUS = "minus";
/**
*
*/
String OPERATION_TYPE_PLUS = "plus";
/**
* 核销
*/
String OPERATION_TYPE_EXCHANGE = "exchange";
String EMPTY_STR = "";
String EVENT_NAME_ADJUSTMENT = "积分调整";
String EVENT_NAME_EXCHANGE = "积分兑换";
String POINT_NOT_ENOUGH = "积分余额不足";
}

43
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml

@ -0,0 +1,43 @@
<?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.PointAdjustmentLogDao">
<resultMap type="com.epmet.entity.PointAdjustmentLogEntity" id="pointAdjustmentLogMap">
<result property="id" column="ID"/>
<result property="actionId" column="ACTION_ID"/>
<result property="operatorName" column="OPERATOR_NAME"/>
<result property="adjustReason" column="ADJUST_REASON"/>
<result property="point" column="POINT"/>
<result property="adjustmentType" column="ADJUSTMENT_TYPE"/>
<result property="operatorAgencyId" column="OPERATOR_AGENCY_ID"/>
<result property="userId" column="USER_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
</resultMap>
<!-- 查询积分调整记录 -->
<select id="selectAdjustmentListByUserId" resultType="com.epmet.dto.result.PointAdjustmentResultDTO">
SELECT
operator_name AS staffNickname,
adjust_reason AS reason,
DATE_FORMAT( created_time, '%Y-%m-%d %H:%i:%s' ) AS date,
CASE
action_flag
WHEN 'plus' THEN
CONCAT( '+', POINT ) ELSE CONCAT( '-', POINT )
END AS POINT
FROM
point_adjustment_log
WHERE
del_flag = '0'
AND user_id = #{userId}
ORDER BY
created_time DESC
</select>
</mapper>

20
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationLogDao.xml

@ -7,8 +7,6 @@
<result property="id" column="ID"/>
<result property="actionId" column="ACTION_ID"/>
<result property="userId" column="USER_ID"/>
<result property="userRegistedGridId" column="USER_REGISTED_GRID_ID"/>
<result property="userRegistedAgnecyId" column="USER_REGISTED_AGNECY_ID"/>
<result property="operatorId" column="OPERATOR_ID"/>
<result property="operatorName" column="OPERATOR_NAME"/>
<result property="operatorAgencyId" column="OPERATOR_AGENCY_ID"/>
@ -42,4 +40,22 @@
ORDER BY
CREATED_TIME DESC
</select>
<!-- 获取工作人员月度核销记录 -->
<select id="selectStaffVerificationLog" resultType="com.epmet.dto.result.WorkPointVerificationLogResultDTO">
SELECT
user_id,
exchanged_item AS remark,
point,
DATE_FORMAT(created_time,'%Y-%m-%d %H:%i:%s') AS date
FROM
point_verification_log
WHERE
del_flag = '0'
AND operator_id = #{staffId}
AND created_time &gt; #{startDate}
AND created_time &lt; #{endDate}
ORDER BY
created_time DESC
</select>
</mapper>

14
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointVerificationStatisticalDailyDao.xml

@ -23,5 +23,19 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 查询指定日期的工作人员核销积分是否存在 -->
<select id="selectIfExisted" resultType="com.epmet.entity.PointVerificationStatisticalDailyEntity">
SELECT
ID,
VERIFICATED_POINT
FROM
point_verification_statistical_daily
WHERE
del_flag = '0'
AND
date_id = #{dateId}
AND
created_by = #{createdBy}
</select>
</mapper>

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

@ -23,12 +23,14 @@
</resultMap>
<!-- 查询客户下周/月度用户积分排行榜 传参:客户Id | 维度 | 维度值 -->
<!-- user_point_statistical_daily中的action_flag有三种key值,plus(获取),exchange(积分兑换),minus(调整、惩罚),当action_flag为minus时,point_change为负值,其余均为正数 -->
<select id="selectPointRankWithinTimeZone" resultType="com.epmet.dto.result.ResiPointRankResultDTO">
SELECT
IF
( @point > point.TOTAL_POINT, @rank := @rank + 1, @rank := @rank + 0 ) AS rank,
point.user_id,
point.TOTAL_POINT,
-- CASE WHEN point.TOTAL_POINT <![CDATA[>=]]> 0 THEN point.TOTAL_POINT ELSE 0 END AS totalPoint,
@point := point.TOTAL_POINT
FROM
(
@ -47,6 +49,8 @@
AND MONTH_ID = #{dimensionId}
</if>
AND ACTION_FLAG = 'plus'
OR ACTION_FLAG = 'minus'
GROUP BY
USER_ID
ORDER BY
@ -55,5 +59,21 @@
( SELECT @point := NULL, @rank := 1 ) a
</select>
<!-- 查询有无指定日期的积分日统计 userId dateId actionFlag-->
<select id="selectIfExisted" resultType="com.epmet.entity.UserPointStatisticalDailyEntity" >
SELECT
id,
point_change
FROM
user_point_statistical_daily
WHERE
del_flag = '0'
AND
user_id = #{userId}
AND
date_id = #{dateId}
AND
action_flag = #{actionFlag}
</select>
</mapper>

15
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointTotalDao.xml

@ -44,4 +44,19 @@
( SELECT @point := NULL, @rank := 1 ) a
</select>
<!-- 根据userId查找是否存在数据 -->
<select id="selectIfExisted" resultType="com.epmet.entity.UserPointTotalEntity">
SELECT
ID,
USERD_POINT,
USABLE_POINT,
TOTAL_POINT
FROM
user_point_total
WHERE
del_flag = '0'
AND
user_id = #{userId}
</select>
</mapper>

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.65
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.72
ports:
- "8110:8110"
network_mode: host # 使用现有网络

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

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-third-server:
container_name: epmet-third-server-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.65
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.72
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.65</version>
<version>0.0.72</version>
<parent>
<groupId>com.epmet</groupId>

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java

@ -72,7 +72,7 @@ public interface CodeCustomerService extends BaseService<CodeCustomerEntity> {
* @author generator
* @date 2020-07-09
*/
void save(CodeCustomerDTO dto);
String save(CodeCustomerDTO dto);
/**
* 默认更新

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java

@ -86,9 +86,10 @@ public class CodeCustomerServiceImpl extends BaseServiceImpl<CodeCustomerDao, Co
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CodeCustomerDTO dto) {
public String save(CodeCustomerDTO dto) {
CodeCustomerEntity entity = ConvertUtils.sourceToTarget(dto, CodeCustomerEntity.class);
insert(entity);
return entity.getId();
}
@Override
@ -123,4 +124,5 @@ public class CodeCustomerServiceImpl extends BaseServiceImpl<CodeCustomerDao, Co
baseDao.deleteCode(customerId, clientType);
}
}

89
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java

@ -14,7 +14,6 @@ import com.epmet.dao.ComponentAccessTokenDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.*;
import com.epmet.wxapi.param.*;
@ -22,6 +21,8 @@ import com.epmet.wxapi.result.*;
import com.epmet.wxapi.service.WxMaCodeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
@ -29,17 +30,18 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/10 10:27
*/
@Slf4j
@Service
public class CodeServiceImpl implements CodeService {
@ -52,8 +54,6 @@ public class CodeServiceImpl implements CodeService {
@Autowired
private CodeCustomerService codeCustomerService;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private CodeAuditResultService codeAuditResultService;
@Autowired
private CustomerMpService customerMpService;
@ -81,12 +81,14 @@ public class CodeServiceImpl implements CodeService {
if (null == wxResult.getData() || wxResult.getData().size() == NumConstant.ZERO) {
return resultList;
}
wxResult.getData().forEach(temp -> {
List<WxMaTemplateResult> sortList =
wxResult.getData().stream().sorted(Comparator.comparing(WxMaTemplateResult::getCreateTime).reversed()).collect(Collectors.toList());
sortList.forEach(temp -> {
TemplateListResultDTO dto = new TemplateListResultDTO();
dto.setId(temp.getTemplateId());
dto.setUserVersion(temp.getUserVersion());
dto.setUserDesc(temp.getUserDesc());
dto.setCreateTime(DateUtils.formatTimestamp(temp.getCreateTime(), DateUtils.DATE_PATTERN));
dto.setCreateTime(DateUtils.formatTimestamp(temp.getCreateTime(), DateUtils.DATE_TIME_PATTERN));
resultList.add(dto);
});
return resultList;
@ -101,14 +103,6 @@ public class CodeServiceImpl implements CodeService {
return codeExtDTO.getExtJson();
}
public static void main(String[] args) {
String json = "{\"extEnable\":true,\"extAppid\":\"wx2679392c4cc2af22\",\"directCommit\":false,\"ext\":{\"extAppid\":\"wx2679392c4cc2af22\",\"footbar\":{\"work\":{\"name\":\"工作\",\"pageTile\":\"工作\"},\"org\":{\"name\":\"组织\",\"pageTile\":\"组织\"},\"data\":{\"name\":\"数据\",\"pageTile\":\"数据\"},\"find\":{\"name\":\"更多\",\"pageTile\":\"更多\"}}}}";
WxExtJson wxExtJson = JSONObject.parseObject(json, WxExtJson.class);
wxExtJson.setExtAppid("123456");
wxExtJson.getExt().setExtAppid("123456");
String extJson = JSON.toJSONString(wxExtJson);
System.out.println(extJson);
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -122,14 +116,11 @@ public class CodeServiceImpl implements CodeService {
if (null == authInfo) {
throw new RenException("未授权");
}
if (!isJson(formDTO.getExtJson())) {
throw new RenException("第三方配置不是有效的Json");
}
WxExtJson wxExtJson = JSONObject.parseObject(formDTO.getExtJson(), WxExtJson.class);
String extJson = getExtJson(formDTO);
WxExtJson wxExtJson = JSONObject.parseObject(extJson, WxExtJson.class);
wxExtJson.setExtAppid(authInfo.getAuthorizerAppid());
wxExtJson.getExt().setExtAppid(authInfo.getAuthorizerAppid());
String extJson = JSON.toJSONString(wxExtJson);
extJson = JSON.toJSONString(wxExtJson);
CodeExtDTO codeExtDTO = codeExtService.getExtByCustomer(formDTO.getCustomerId(), formDTO.getClientType());
if (null == codeExtDTO) {
codeExtDTO = new CodeExtDTO();
@ -164,9 +155,9 @@ public class CodeServiceImpl implements CodeService {
codeCustomerDTO.setExtJson(extJson);
codeCustomerDTO.setAppId(authInfo.getAuthorizerAppid());
codeCustomerDTO.setStatus(CodeConstant.UNAUDITED);
codeCustomerService.save(codeCustomerDTO);
String codeId = codeCustomerService.save(codeCustomerDTO);
saveOperation(formDTO.getCustomerId(), codeCustomerDTO.getId(), formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, "上传成功");
saveOperation(formDTO.getCustomerId(), codeId, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, "上传成功");
}
@Override
@ -373,7 +364,7 @@ public class CodeServiceImpl implements CodeService {
//获取上传代码信息
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId());
if (null != codeCustomerDTO.getQrCode()) {
result.setQrcode(codeCustomerDTO.getQrCode());
result.setQrcode(codeCustomerDTO.getQrCode());
return result;
}
//是否授权
@ -409,8 +400,8 @@ public class CodeServiceImpl implements CodeService {
@Override
public String mediaUpload(MediaUploadFormDTO formDTO) {
try {
Result<UploadImgResultDTO> uploadWxImg = ossFeignClient.uploadWxImg(formDTO.getMedia());
File file = new File(uploadWxImg.getData().getUrl());
File file = new File(formDTO.getMedia().getOriginalFilename());
FileUtils.copyInputStreamToFile(formDTO.getMedia().getInputStream(), file);
//获取上传代码信息
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId());
//获取小程序调用令牌
@ -443,50 +434,4 @@ public class CodeServiceImpl implements CodeService {
codeOperationHistoryService.save(operationDTO);
}
/**
* 校验是否是Json
*
* @param content
* @return boolean
* @author zhaoqifeng
* @date 2020/7/17 15:43
*/
private boolean isJson(String content) {
try {
JSONObject jsonStr = JSONObject.parseObject(content);
return true;
} catch (Exception e) {
return false;
}
}
private byte[] toPrimitives(Byte[] oBytes) {
byte[] bytes = new byte[oBytes.length];
for (int i = 0; i < oBytes.length; i++) {
bytes[i] = oBytes[i];
}
return bytes;
}
private void byteToFile(byte[] bytes)
{
try
{
// 根据绝对路径初始化文件
File localFile = new File(".");
if (!localFile.exists())
{
localFile.createNewFile();
}
// 输出流
OutputStream os = new FileOutputStream(localFile);
os.write(bytes);
os.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

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

Loading…
Cancel
Save