Browse Source

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

dev_shibei_match
wangchao 5 years ago
parent
commit
239c3e499f
  1. 2
      epmet-auth/deploy/docker-compose-dev.yml
  2. 2
      epmet-auth/pom.xml
  3. 24
      epmet-auth/src/main/java/com/epmet/constant/AuthHttpUrlConstant.java
  4. 30
      epmet-auth/src/main/java/com/epmet/constant/ThirdApiConstant.java
  5. 25
      epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java
  6. 5
      epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java
  7. 4
      epmet-auth/src/main/java/com/epmet/dto/form/PaWxCodeFormDTO.java
  8. 6
      epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java
  9. 62
      epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java
  10. 86
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  11. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  12. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ConvertUtils.java
  13. 2
      epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-dev.yml
  14. 2
      epmet-module/epmet-common-service/common-service-server/pom.xml
  15. 22
      epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.2__add_event.sql
  16. 4
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java
  17. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java
  18. 27
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java
  19. 86
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiVolunteerInfoResultDTO.java
  20. 23
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java
  21. 2
      epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml
  22. 2
      epmet-module/epmet-heart/epmet-heart-server/pom.xml
  23. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  24. 23
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  25. 33
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActGrantPointLogDao.java
  26. 13
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java
  27. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java
  28. 73
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActGrantPointLogEntity.java
  29. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java
  30. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  31. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java
  32. 46
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  33. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  34. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  35. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
  36. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql
  37. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActGrantPointLogDao.xml
  38. 40
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml
  39. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml
  40. 19
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/constant/HttpUrlConstant.java
  41. 14
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ComponentAccessTokenServiceImpl.java
  42. 14
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/RefreshAuthAccessTokenServiceImpl.java
  43. 2
      epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml
  44. 2
      epmet-module/epmet-point/epmet-point-server/pom.xml
  45. 4
      epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/epmet_point.sql
  46. 27
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CheckPaUserFormDTO.java
  47. 12
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterByAuthFormDTO.java
  48. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterFormDTO.java
  49. 9
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterInfoFormDTO.java
  50. 6
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveUserVisitedFormDTO.java
  51. 28
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WxCodeToTokenFormDTO.java
  52. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml
  53. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  54. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  55. 17
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java
  56. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java
  57. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java
  58. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerUserAgencyDao.java
  59. 15
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java
  60. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java
  61. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java
  62. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  63. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java
  64. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java
  65. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java
  66. 42
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java
  67. 27
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  68. 35
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java
  69. 1
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java
  70. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java
  71. 7
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java
  72. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaCategoryResult.java
  73. 20
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml
  74. 2
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml
  75. 32
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerUserAgencyDao.xml
  76. 19
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml
  77. 4
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml
  78. 31
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml
  79. 2
      epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml
  80. 2
      epmet-module/oper-crm/oper-crm-server/pom.xml
  81. 10
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  82. 11
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/constant/GuideHttpUrlConstant.java
  83. 32
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java
  84. 18
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  85. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  86. 2
      epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
  87. 2
      epmet-user/epmet-user-server/pom.xml
  88. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java
  89. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.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.57
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.58
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.57</version>
<version>0.3.58</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId>

24
epmet-auth/src/main/java/com/epmet/constant/AuthHttpUrlConstant.java

@ -0,0 +1,24 @@
package com.epmet.constant;
/**
* @Author zxc
* @CreateTime 2020/7/30 10:05
*/
public interface AuthHttpUrlConstant {
/**
* 注册url
*/
String REGISTER_URL = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/register";
/**
* 获取客户信息url
*/
String CUSTOMER_MSG_URL = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/";
/**
* 登录url
*/
String RESI_AND_WORK_LOGIN_URL = "https://epmet-cloud.elinkservice.cn/api/third/customermp/resiandworklogin";
}

30
epmet-auth/src/main/java/com/epmet/constant/ThirdApiConstant.java

@ -0,0 +1,30 @@
package com.epmet.constant;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/30 10:46
*/
public interface ThirdApiConstant {
/**
* 根据openId新增或更新用户信息
*/
String THIRD_PAUSER_SAVEUSER = "https://epmet-cloud.elinkservice.cn/api/third/pauser/saveuser";
/**
* 根据手机号查询公众号用户基本信息校验用户是否存在
*/
String THIRD_PAUSER_CHECKPAUSER = "https://epmet-cloud.elinkservice.cn/api/third/pauser/checkpauser";
/**
* 用户登陆新增访问记录数据
*/
String THIRD_PAUSERVISITED_SAVEUSERVISITED = "https://epmet-cloud.elinkservice.cn/api/third/pauservisited/saveuservisited";
/**
* 根据客户Id查询各项注册信息
*/
String THIRD_PACUSTOMER_GETCUSTOMERAGENCYUSER = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/getcustomeragencyuser/";
/**
* 修改客户数据状态为已完成初始化
*/
String THIRD_PACUSTOMER_UPDATECUSTOMER = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/updatecustomer/";
}

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

@ -1,6 +1,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@ -12,11 +13,12 @@ import com.epmet.dto.form.PublicSendSmsCodeFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.PublicUserLoginService;
import com.netflix.ribbon.proxy.annotation.Http;
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 org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.*;
/**
* 描述一下
@ -38,8 +40,10 @@ public class PublicUserLoginController {
* @description 解析wxcode获取用户信息并生成token
**/
@PostMapping(value = "/wxcodetotoken")
public Result<UserTokenResultDTO> wxCodeToToken(@RequestBody PaWxCodeFormDTO formDTO) {
public Result<UserTokenResultDTO> wxCodeToToken(@RequestHeader("source") String source, @RequestBody PaWxCodeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PaWxCodeFormDTO.AddUserInternalGroup.class);
formDTO.setSource(source);
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.wxCodeToToken(formDTO));
}
@ -50,11 +54,12 @@ public class PublicUserLoginController {
* @Description 公众号登录-发送验证码
**/
@PostMapping(value = "/sendsmscode")
public Result sendSmsCode(@RequestBody PublicSendSmsCodeFormDTO formDTO) {
public Result sendSmsCode(@RequestHeader("source") String source, @RequestBody PublicSendSmsCodeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,PublicSendSmsCodeFormDTO.AddUserShowGroup.class);
if(formDTO.getIsLogon()!=true&&formDTO.getIsLogon()!=false){
if (formDTO.getIsLogon() != true && formDTO.getIsLogon() != false) {
throw new RenException(PublicUserLoginConstant.PARAMETER_EXCEPTION);
}
formDTO.setSource(source);
publicUserLoginService.sendSmsCode(formDTO);
return new Result();
}
@ -66,8 +71,9 @@ public class PublicUserLoginController {
* @Description 公众号-手机验证码登陆
**/
@PostMapping(value = "/loginbyphone")
public Result<UserTokenResultDTO> loginByPhone(@LoginUser TokenDto tokenDTO, @RequestBody LoginByPhoneFormDTO formDTO) {
public Result<UserTokenResultDTO> loginByPhone(@RequestHeader("source") String source, @LoginUser TokenDto tokenDTO, @RequestBody LoginByPhoneFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, LoginByPhoneFormDTO.AddUserShowGroup.class, LoginByPhoneFormDTO.LoginByPhone.class);
formDTO.setSource(source);
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO));
}
@ -78,9 +84,10 @@ public class PublicUserLoginController {
* @Description 公众号-手机号注册
**/
@PostMapping(value = "/register")
public Result<UserTokenResultDTO> register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) {
public Result<UserTokenResultDTO> register(@RequestHeader("source") String source, @LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class);
formDTO.setUserId(tokenDTO.getUserId());
formDTO.setSource(source);
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.register(formDTO));
}

5
epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java

@ -34,5 +34,10 @@ public class LoginByPhoneFormDTO implements Serializable {
@NotBlank(message="验证码不能为空", groups = {LoginByPhone.class})
private String smsCode;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
private String source;
}

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

@ -20,4 +20,8 @@ public class PaWxCodeFormDTO implements Serializable {
*/
@NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class})
private String wxCode;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
private String source;
}

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

@ -26,8 +26,14 @@ public class PublicSendSmsCodeFormDTO implements Serializable {
*/
@NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class})
private String phone;
/**
* 是否登陆登陆true 注册false
*/
private Boolean isLogon;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
private String source;
}

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

@ -1,17 +1,21 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.*;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.PhoneValidatorUtils;
import com.epmet.constant.AuthHttpUrlConstant;
import com.epmet.constant.PublicUserLoginConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.constant.ThirdApiConstant;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.PaUserWechatDTO;
@ -32,10 +36,8 @@ 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.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -68,13 +70,17 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
public UserTokenResultDTO wxCodeToToken(PaWxCodeFormDTO formDTO) {
//1.通过微信code获取用户基本信息
WxMpUser wxMpUser = this.getWxMpUser(formDTO.getWxCode());
WxCodeToTokenFormDTO dto = new WxCodeToTokenFormDTO();
dto.setWxMpUser(wxMpUser);
dto.setSource(formDTO.getSource());
//2.将获取的用户基本信息初始化到数据库
Result<SaveUserResultDTO> result = epmetThirdFeignClient.saveUser(wxMpUser);
String url = ThirdApiConstant.THIRD_PAUSER_SAVEUSER;
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(dto));
if (!result.success()) {
throw new RenException(PublicUserLoginConstant.SAVE_USER_EXCEPTION);
}
SaveUserResultDTO resultDTO = result.getData();
SaveUserResultDTO resultDTO = JSONObject.parseObject(result.getData(), SaveUserResultDTO.class);
//3.获取用户token
String token = this.generateGovWxmpToken(resultDTO.getUserId());
@ -156,19 +162,23 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getPhone(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg()));
throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode());
}
//2、根据手机号校验用户是否存在
Result<CustomerUserResultDTO> Result = epmetThirdFeignClient.checkPaUser(formDTO.getPhone());
if (!Result.success()) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getPhone(), Result.getCode(), Result.getMsg()));
throw new RenException(Result.getCode());
//2、根据数据来源和手机号校验用户是否存在
CheckPaUserFormDTO dto = new CheckPaUserFormDTO();
dto.setPhone(formDTO.getPhone());
dto.setSource(formDTO.getSource());
String url = ThirdApiConstant.THIRD_PAUSER_CHECKPAUSER;
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(dto));
if (!result.success()) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getPhone(), result.getCode(), result.getMsg()));
throw new RenException(result.getCode());
}
CustomerUserResultDTO ResultDTO = Result.getData();
CustomerUserResultDTO resultDTO = JSONObject.parseObject(result.getData(), CustomerUserResultDTO.class);
//登陆
if (formDTO.getIsLogon() && null == ResultDTO.getPaUserResult()) {
if (formDTO.getIsLogon() && null == resultDTO.getPaUserResult()) {
throw new RenException(EpmetErrorCode.PUBLIC_NOT_EXISTS.getCode());
}
//注册
if (!formDTO.getIsLogon() && null != ResultDTO.getPaUserResult()) {
if (!formDTO.getIsLogon() && null != resultDTO.getPaUserResult()) {
throw new RenException(EpmetErrorCode.MOBILE_USED.getCode());
}
//3、发送短信验证码
@ -194,13 +204,17 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
**/
@Override
public UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO) {
//1.根据手机号查询到用户、客户信息
Result<CustomerUserResultDTO> result = epmetThirdFeignClient.checkPaUser(formDTO.getPhone());
//1.根据数据来源和手机号查询用户、客户信息
CheckPaUserFormDTO dto = new CheckPaUserFormDTO();
dto.setPhone(formDTO.getPhone());
dto.setSource(formDTO.getSource());
String url = ThirdApiConstant.THIRD_PAUSER_CHECKPAUSER;
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(dto));
if (!result.success()) {
logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getPhone(), result.getCode(), result.getMsg()));
throw new RenException(result.getCode());
}
CustomerUserResultDTO resultDTO = result.getData();
CustomerUserResultDTO resultDTO = JSONObject.parseObject(result.getData(), CustomerUserResultDTO.class);
//2.用户不存在时不允许登陆
PaUserDTO userDTO = resultDTO.getPaUserResult();
@ -236,7 +250,9 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
visited.setUserId(userDTO.getId());
visited.setLogonUserId(tokenDTO.getUserId());
visited.setPhone(formDTO.getPhone());
Result visitedResult = epmetThirdFeignClient.saveUserVisited(visited);
visited.setSource(formDTO.getSource());
String saveUserVisitedUrl = ThirdApiConstant.THIRD_PAUSERVISITED_SAVEUSERVISITED;
Result<String> visitedResult = HttpClientManager.getInstance().sendPostByJSON(saveUserVisitedUrl, JSON.toJSONString(visited));
if(!visitedResult.success()){
logger.error(PublicUserLoginConstant.SAVE_VISITED_EXCEPTION);
}
@ -256,12 +272,16 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
@Override
public UserTokenResultDTO register(RegisterFormDTO formDTO) {
//1.调用epmet-third服务,完成信息注册
Result<RegisterResultDTO> result = epmetThirdFeignClient.register(formDTO);
String data = HttpClientManager.getInstance().sendPostByJSON(AuthHttpUrlConstant.REGISTER_URL, JSON.toJSONString(formDTO)).getData();
JSONObject toResult = JSON.parseObject(data);
Result result = ConvertUtils.mapToEntity(toResult, Result.class);
if (!result.success()) {
logger.error("调用epmet_third服务初始化用户信息失败");
logger.error(String.format("调用epmet_third服务初始化用户信息失败,数据来源[%s],手机号[%s],userId:[%S]", formDTO.getSource(), formDTO.getPhone(), formDTO.getUserId()));
throw new RenException(result.getCode());
}
RegisterResultDTO resultDTO = result.getData();
Object RegisterResult = result.getData();
JSONObject jsonObject = JSON.parseObject(RegisterResult.toString());
RegisterResultDTO resultDTO = ConvertUtils.mapToEntity(jsonObject, RegisterResultDTO.class);
//2.直接生成一个新的token放入缓存中(不管缓存中是否存在旧的token,都重新生成)
//2-1.生成token

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

@ -1,6 +1,8 @@
package com.epmet.service.impl;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -9,10 +11,8 @@ 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.commons.tools.utils.*;
import com.epmet.constant.AuthHttpUrlConstant;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -70,12 +70,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO();
resiLoginFormDTO.setAppId(formDTO.getAppId());
resiLoginFormDTO.setWxCode(formDTO.getWxCode());
Result<UserWechatDTO> result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO);
if (!result.success()) {
logger.error("居民端小程序登陆,调用epmet_third服务获取数据失败");
throw new RenException(result.getCode());
}
UserWechatDTO userWechatDTO = result.getData();
UserWechatDTO userWechatDTO = this.getUserWeChat(resiLoginFormDTO);
//2.调用epmet-user服务,新增用户信息(先判断用户是否存在,不存在则新增存在则更新)
WxUserFormDTO wxUserFormDTO = new WxUserFormDTO();
@ -83,7 +78,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
wxUserFormDTO.setApp(formDTO.getApp());
Result<UserDTO> userResult = epmetUserOpenFeignClient.saveWxUser(wxUserFormDTO);
if (!userResult.success()) {
throw new RenException(result.getCode());
throw new RenException(userResult.getCode());
}
UserDTO userDTO = userResult.getData();
@ -147,12 +142,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO();
resiLoginFormDTO.setAppId(formDTO.getAppId());
resiLoginFormDTO.setWxCode(formDTO.getWxCode());
Result<UserWechatDTO> result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO);
if (!result.success()) {
logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败");
throw new RenException(result.getCode());
}
UserWechatDTO userWechatDTO = result.getData();
UserWechatDTO userWechatDTO = this.getUserWeChat(resiLoginFormDTO);
//2.根据openid查询用户是否存在历史登陆信息
Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserOpenFeignClient.getLatestStaffWechatLoginRecord(userWechatDTO.getWxOpenId());
@ -369,12 +359,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO();
resiLoginFormDTO.setAppId(formDTO.getAppId());
resiLoginFormDTO.setWxCode(formDTO.getWxCode());
Result<UserWechatDTO> result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO);
if (!result.success()) {
logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败");
throw new RenException(result.getCode());
}
UserWechatDTO userWechatDTO = result.getData();
UserWechatDTO userWechatDTO = this.getUserWeChat(resiLoginFormDTO);
WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult();
wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId());
wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey());
@ -419,12 +404,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
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();
PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId());
//7.28 根据appId只能存在一个客户Id,后边的批量操作逻辑
//2.根据手机号查询到用户信息
@ -461,12 +441,8 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
@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();
// Result<PublicCustomerResultDTO> resultDTO = epmetThirdFeignClient.getCustomerMsg(formDTO.getAppId());
PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId());
//7.28 上边根据appId只能锁定一条客户id,后边的批量循环操作暂不做调整,还是使用之前的代码 sun
//1、根据手机号查询到用户信息
ThirdCustomerStaffFormDTO dto = new ThirdCustomerStaffFormDTO();
@ -526,4 +502,44 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
return new ArrayList<>();
}
/**
* @Description 获取客户信息
* @param appId
* @author zxc
*/
public PaCustomerDTO getCustomerInfo(String appId){
JSONObject jsonObject = new JSONObject();
String data = HttpClientManager.getInstance().sendPostByJSON(AuthHttpUrlConstant.CUSTOMER_MSG_URL + appId, JSON.toJSONString(jsonObject)).getData();
JSONObject toResult = JSON.parseObject(data);
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class);
if (!mapToResult.success()) {
logger.error(String.format("根据appId查询客户Id失败,对应appId->" + appId));
throw new RenException(mapToResult.getMsg());
}
Object PublicCustomerResultDTO = mapToResult.getData();
JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString());
PublicCustomerResultDTO publicCustomerResultDTO = ConvertUtils.mapToEntity(json, PublicCustomerResultDTO.class);
PaCustomerDTO customer = publicCustomerResultDTO.getCustomer();
return customer;
}
/**
* @Description 获取UserWechatDTO
* @param resiLoginFormDTO
* @author zxc
*/
public UserWechatDTO getUserWeChat(WxLoginFormDTO resiLoginFormDTO){
String data = HttpClientManager.getInstance().sendPostByJSON(AuthHttpUrlConstant.RESI_AND_WORK_LOGIN_URL, JSON.toJSONString(resiLoginFormDTO)).getData();
JSONObject toResult = JSON.parseObject(data);
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class);
if (!mapToResult.success()) {
logger.error("居民端小程序登陆,调用epmet_third服务获取数据失败");
throw new RenException(mapToResult.getCode());
}
Object UserWeChatDTO = mapToResult.getData();
JSONObject json = JSON.parseObject(UserWeChatDTO.toString());
UserWechatDTO userWechatDTO = ConvertUtils.mapToEntity(json, UserWechatDTO.class);
return userWechatDTO;
}
}

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

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

26
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ConvertUtils.java

@ -12,9 +12,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 转换工具类
@ -58,4 +60,28 @@ public class ConvertUtils {
return targetList;
}
public static <T> T mapToEntity(Map<String, Object> map, Class<T> entity) {
T t = null;
try {
t = entity.newInstance();
for(Field field : entity.getDeclaredFields()) {
if (map.containsKey(field.getName())) {
boolean flag = field.isAccessible();
field.setAccessible(true);
Object object = map.get(field.getName());
if (object!= null && field.getType().isAssignableFrom(object.getClass())) {
field.set(t, object);
}
field.setAccessible(flag);
}
}
return t;
} catch (InstantiationException e) {
logger.error("convert error ", e);
} catch (IllegalAccessException e) {
logger.error("convert error ", e);
}
return t;
}
}

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

@ -2,7 +2,7 @@ version: "3.7"
services:
common-service-server:
container_name: common-service-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/common-service-server:0.3.5
image: 192.168.1.130:10080/epmet-cloud-dev/common-service-server:0.3.6
ports:
- "8103:8103"
network_mode: host # 使用现有网络

2
epmet-module/epmet-common-service/common-service-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.5</version>
<version>0.3.6</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-common-service</artifactId>

22
epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/V0.0.2__add_event.sql

@ -0,0 +1,22 @@
CREATE TABLE `event` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CLASS_ID` varchar(32) DEFAULT NULL COMMENT '消息网关事件类别ID 从消息网关获取事件类型Id',
`APP_ID` varchar(128) DEFAULT NULL COMMENT '消息网关APP_ID',
`APP_NAME` varchar(32) DEFAULT NULL COMMENT '消息网关APP_NAME',
`EVENT_CODE` varchar(32) DEFAULT NULL COMMENT '事件标识 与消息网关事件tag一致',
`EVENT_NAME` varchar(32) DEFAULT NULL COMMENT '事件名称',
`EVENT_DESC` varchar(64) DEFAULT NULL COMMENT '事件说明',
`FUNCTION_ID` varchar(64) DEFAULT NULL COMMENT '功能ID 来自oper_customize.customer_function表',
`IS_COMMON` varchar(1) DEFAULT NULL COMMENT '是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值',
`DEL_FLAG` varchar(1) DEFAULT NULL COMMENT '删除标识 0-否,1-是',
`REVISION` int(11) DEFAULT NULL COMMENT '乐观锁 查询时添加版本号,新加的事件需要更新版本号',
`CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人',
`CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人',
`UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`),
UNIQUE KEY `unx_event_code` (`EVENT_CODE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件表';
INSERT INTO `epmet_common_service`.`event`(`ID`, `CLASS_ID`, `APP_ID`, `APP_NAME`, `EVENT_CODE`, `EVENT_NAME`, `EVENT_DESC`, `FUNCTION_ID`, `IS_COMMON`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', 'epmet_heart', '202007161443499985fa2d397436d10356542134c8f008c48', '党群e事通开发测试', 'register_volunteer', '注册志愿者', '给注册志愿者的人发放积分', '43addd0735230c01eedbb38d721076b0', '0', '0', 0, 'APP_USER', '2020-07-23 14:19:17', 'APP_USER', '2020-07-23 14:19:17');
INSERT INTO `epmet_common_service`.`event`(`ID`, `CLASS_ID`, `APP_ID`, `APP_NAME`, `EVENT_CODE`, `EVENT_NAME`, `EVENT_DESC`, `FUNCTION_ID`, `IS_COMMON`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', 'epmet_heart', '202007161443499985fa2d397436d10356542134c8f008c48', '党群e事通开发测试', 'active_send_point', '活动发放积分', '给参加活动的人发放积分', '43addd0735230c01eedbb38d721076b0', '0', '0', 0, 'APP_USER', '2020-07-23 14:16:49', 'APP_USER', '2020-07-23 14:16:49');
INSERT INTO `epmet_common_service`.`event`(`ID`, `CLASS_ID`, `APP_ID`, `APP_NAME`, `EVENT_CODE`, `EVENT_NAME`, `EVENT_DESC`, `FUNCTION_ID`, `IS_COMMON`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('3', 'epmet_heart', '202007161443499985fa2d397436d10356542134c8f008c48', '党群e事通开发测试', 'publist_active_live', '发布实况', '给发布实况的人发放积分', '43addd0735230c01eedbb38d721076b0', '0', '0', 0, 'APP_USER', '2020-07-23 14:16:49', 'APP_USER', '2020-07-23 14:16:49');

4
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java

@ -19,4 +19,8 @@ public class UserHistoricalActFormDTO implements Serializable {
*/
@NotBlank(message = "居民端用户id不能为空", groups = {AddUserInternalGroup.class})
private String userId;
@NotBlank(message = "当前活动id不能为空", groups = {AddUserInternalGroup.class})
private String currentActId;
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java

@ -137,4 +137,9 @@ public class ResiActDetailResultDTO implements Serializable {
* 是否已签到(true已签到false未签到)
*/
private Boolean isSignUp;
/**
* 用户是否已报名该活动 true用户已报名false用户未报名
*/
private Boolean isRegistration;
}

27
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java

@ -1,27 +0,0 @@
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 活动报名 - 返回值
*
* @Auther: zhangyong
* @Date: 2020-07-28 16:22
*/
@Data
public class ResiActRegistrationResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 异常编码
*/
private Integer flag;
/**
* 提示信息
*/
private String tip;
}

86
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiVolunteerInfoResultDTO.java

@ -0,0 +1,86 @@
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 志愿者信息+用户基础信息 返回值
* @Auther: zhangyong
* @Date: 2020-07-28 14:40
*/
@Data
public class ResiVolunteerInfoResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
private String userId;
/**
* 手机号(注册手机号)
*/
private String mobile;
/**
* 姓氏
*/
private String surname;
/**
*
*/
private String name;
/**
* 姓名
*/
private String realName;
/**
* 身份证号
*/
private String idNum;
/**
* 性别1男2女0未知
*/
private String gender;
/**
* 街道
*/
private String street;
/**
* 小区名称
*/
private String district;
/**
* 楼栋单元
*/
private String buildingAddress;
/**
* 昵称(目前来源于微信昵称后续系统可支持用户有昵称)
*/
private String nickname;
/**
* 头像目前来源于微信后续系统顾客支持上传头像
*/
private String headImgUrl;
/**
* 志愿者签名
*/
private String volunteerSignature;
/**
* 志愿者自我介绍
*/
private String volunteerIntroduce;
}

23
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java

@ -53,4 +53,27 @@ public class UserHistoricalActInfoDTO implements Serializable {
* 已处理: handled; 默认"",重新处理时reward_flag置为空字符串
*/
private String processFlag;
// 新增以下参数
/**
* 活动状态
已发布/报名中published
已取消canceled;
已结束finished
*/
private String actStatus;
/**
* 当前状态已报名/待审核auditing
审核通过passed
审核不通过refused
取消报名canceled
*/
private String userActStatus;
/**
* true已签到false未签到
*/
private Boolean signInFlag;
}

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

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

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

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.0.11</version>
<version>0.0.14</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-heart</artifactId>

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

@ -294,12 +294,12 @@ public class ResiActListController {
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRegistrationResultDTO>
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 16:26 2020-07-28
**/
@PostMapping("registration")
public Result<ResiActRegistrationResultDTO> registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) {
public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActRegistrationFormDTO.AddUserInternalGroup.class);
return actUserRelationService.registration(tokenDto, formDTO);
}

23
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -23,6 +23,8 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.service.VolunteerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -44,9 +46,30 @@ public class ResiVolunteerController {
@Autowired
private VolunteerInfoService volunteerInfoService;
/**
* 志愿者认证
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 13:59 2020-07-30
**/
@PostMapping("authenticate")
public Result authenticate(@LoginUser TokenDto tokenDto, @RequestBody ResiVolunteerAuthenticateFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiVolunteerAuthenticateFormDTO.AddUserInternalGroup.class, ResiVolunteerAuthenticateFormDTO.AddUserShowGroup.class);
return volunteerInfoService.authenticate(tokenDto, formDTO);
}
/**
* 志愿者认证界面获取用户基础信息+志愿者信息
*
* @param tokenDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO>
* @Author zhangyong
* @Date 15:20 2020-07-28
**/
@PostMapping("selectvolunteerinfo")
public Result<ResiVolunteerInfoResultDTO> selectVolunteerInfo(@LoginUser TokenDto tokenDTO){
return volunteerInfoService.selectVolunteerInfoByUserId(tokenDTO);
}
}

33
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActGrantPointLogDao.java

@ -0,0 +1,33 @@
/**
* 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.entity.ActGrantPointLogEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 活动发放积分日志表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-30
*/
@Mapper
public interface ActGrantPointLogDao extends BaseDao<ActGrantPointLogEntity> {
}

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

@ -119,7 +119,7 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
* @description 根据userId查询参与活动记录
* @Date 2020/7/23 16:46
**/
List<UserHistoricalActInfoDTO> selectAllByUserId(String userId);
List<UserHistoricalActInfoDTO> selectAllByUserId(@Param("userId") String userId,@Param("currentActId") String currentActId);
/**
* @return java.util.List<com.epmet.dto.ActUserRelationDTO>
@ -206,4 +206,15 @@ public interface ActUserRelationDao extends BaseDao<ActUserRelationEntity> {
* @Date 2020/7/27 14:59
**/
List<ActUserRelationDTO> selectAuditingAndPassedList(String actId);
/**
* 查询当前用户与活动之间的状态
*
* @param actId
* @param userId
* @return java.lang.String
* @Author zhangyong
* @Date 15:59 2020-07-30
**/
String selectUserStatusByActIdAndUserId(@Param("actId") String actId, @Param("userId")String userId);
}

11
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.entity.VolunteerInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -52,4 +53,14 @@ public interface VolunteerInfoDao extends BaseDao<VolunteerInfoEntity> {
* @Date 15:05 2020-07-23
**/
void updateVolunteerInfoByUserId(VolunteerInfoEntity entity);
/**
* 根据用户id查询志愿者信息
*
* @param userId
* @return java.lang.String
* @Author zhangyong
* @Date 14:33 2020-07-23l
**/
VolunteerInfoDTO selectVolunteerInfoByUserId(@Param("userId") String userId);
}

73
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActGrantPointLogEntity.java

@ -0,0 +1,73 @@
/**
* 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;
/**
* 活动发放积分日志表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-30
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("act_grant_point_log")
public class ActGrantPointLogEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String customerId;
/**
*
*/
private String actId;
/**
*
*/
private Integer reward;
/**
*
*/
private String remark;
/**
*
*/
private String operatorId;
/**
*
*/
private String sendMsg;
/**
*
*/
private String responseMsg;
}

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java

@ -24,7 +24,6 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActRegistrationFormDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.dto.result.resi.ResiActRegistrationResultDTO;
import com.epmet.entity.ActUserRelationEntity;
import org.apache.ibatis.annotations.Param;
@ -146,9 +145,9 @@ public interface ActUserRelationService extends BaseService<ActUserRelationEntit
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.Map<java.lang.Integer,java.lang.String>>
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 15:54 2020-07-28
**/
Result<ResiActRegistrationResultDTO> registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO);
Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO);
}

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java

@ -23,6 +23,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.entity.VolunteerInfoEntity;
import java.util.List;
@ -47,4 +48,13 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
**/
Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO);
/**
* 志愿者认证界面获取用户基础信息+志愿者信息
*
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO>
* @Author zhangyong
* @Date 14:05 2020-07-30
**/
Result<ResiVolunteerInfoResultDTO> selectVolunteerInfoByUserId(TokenDto tokenDto);
}

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

@ -222,6 +222,14 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
Boolean volunteerFlag = heartUserInfoDao.selectUserVolunteerFlag(formDto.getUserId());
detailResultDTO.setUserVolunteerFlag(volunteerFlag);
// 查询用户是否已报名活动
String status = actUserRelationDao.selectUserStatusByActIdAndUserId(formDto.getActId(), formDto.getUserId());
detailResultDTO.setIsRegistration(false);
if (null != status){
if (ActConstant.ACT_USER_STATUS_PASSED.equals(status) || ActConstant.ACT_USER_STATUS_AUDITING.equals(status)){
detailResultDTO.setIsRegistration(true);
}
}
// 获取用户报名状态
String currentUserStatus = getCurrentUserStatus(formDto.getActId(), formDto.getUserId());
detailResultDTO.setCurrentUserStatus(currentUserStatus);
@ -250,7 +258,7 @@ public class ActInfoServiceImpl extends BaseServiceImpl<ActInfoDao, ActInfoEntit
return ActConstant.CURRENT_STATUS_USER_FINISHED;
}
// 查询用户是否报名该活动
// 查询用户是否报名参加过该活动
QueryWrapper<ActUserRelationEntity> actUserRelationWrapper = new QueryWrapper<>();
actUserRelationWrapper.eq("ACT_ID", actId)
.eq("USER_ID", userId)

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

@ -39,7 +39,6 @@ import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActRegistrationFormDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.dto.result.resi.ResiActRegistrationResultDTO;
import com.epmet.entity.ActUserLogEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.entity.HeartUserInfoEntity;
@ -48,6 +47,7 @@ import com.epmet.redis.ActUserRelationRedis;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserLogService;
import com.epmet.service.ActUserRelationService;
import com.epmet.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -195,46 +195,40 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Override
@Transactional(rollbackFor = Exception.class)
public Result<ResiActRegistrationResultDTO> registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) {
public Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
boolean satisfy = false;
ResiActRegistrationResultDTO resultDTO = new ResiActRegistrationResultDTO();
// 查询活动信息
ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId());
// >0 当前用户是志愿者
Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getUserId());
if (actInfoDTO.getVolunteerLimit()){
// 活动只能志愿者参加, 当前用户是否满足条件
satisfy = this.volunteerParticipationAct(volunteerFlag);
if (!satisfy){
logger.info(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getMsg());
resultDTO.setFlag(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
resultDTO.setTip(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
if (NumConstant.ZERO < volunteerFlag){
// 志愿者身份,可参加所有活动
satisfy = true;
} else {
// 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件
satisfy = this.resiParticipationAct(formDTO.getUserId());
if (!satisfy){
logger.info(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg());
resultDTO.setFlag(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
resultDTO.setTip(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
// 如果用户不是志愿者,则需判断,当前活动 非志愿者是非可报名
if (actInfoDTO.getVolunteerLimit()){
// 活动只能志愿者参加, 当前用户是否满足条件
satisfy = this.volunteerParticipationAct(volunteerFlag);
} else {
// 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件
satisfy = this.resiParticipationAct(formDTO.getUserId());
}
}
if (satisfy){
// 开始报名
boolean actTimeConflict = this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag);
if (!actTimeConflict){
logger.info(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg());
resultDTO.setFlag(EpmetErrorCode.ACT_TIME_CONFLICT.getCode());
resultDTO.setTip(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
logger.info(EpmetErrorCode.ACT_TIME_CONFLICT);
throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode());
}
} else {
// 不满足,提示用户去认证志愿者
logger.info(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER);
throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
}
resultDTO.setFlag(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getCode());
resultDTO.setTip(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
return new Result();
}
/**

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

@ -24,6 +24,7 @@ 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.BasePointEventMsg;
import com.epmet.commons.tools.enums.EventEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -31,8 +32,11 @@ import com.epmet.commons.tools.utils.SendMqMsgUtils;
import com.epmet.constant.ActMessageConstant;
import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.WxUserInfoFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.VolunteerInfoRedis;
@ -134,4 +138,26 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
wxUserInfoFormDTO.setGender(formDTO.getGender());
return wxUserInfoFormDTO;
}
@Override
public Result<ResiVolunteerInfoResultDTO> selectVolunteerInfoByUserId(TokenDto tokenDto) {
ResiVolunteerInfoResultDTO resultDTO = new ResiVolunteerInfoResultDTO();
// 获取用户基本信息
Result<ResiUserBaseInfoResultDTO> userBaseInfo = epmetUserOpenFeignClient.selectUserBaseInfo(tokenDto);
if (userBaseInfo.success()){
resultDTO = ConvertUtils.sourceToTarget(userBaseInfo.getData(), ResiVolunteerInfoResultDTO.class);
// 判断是不是志愿者
Integer volunteerFlag = baseDao.queryVolunteerFlagByUserId(tokenDto.getUserId());
if (volunteerFlag > NumConstant.ZERO){
// 获取志愿者信息
VolunteerInfoDTO dto = baseDao.selectVolunteerInfoByUserId(tokenDto.getUserId());
resultDTO.setVolunteerIntroduce(dto.getVolunteerIntroduce());
resultDTO.setVolunteerSignature(dto.getVolunteerSignature());
}
} else {
logger.error("获取用户基本信息失败");
throw new RenException("获取用户基本信息失败!");
}
return new Result<ResiVolunteerInfoResultDTO>().ok(resultDTO);
}
}

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

@ -89,7 +89,8 @@ public class WorkActServiceImpl implements WorkActService {
private HeartUserInfoService heartUserInfoService;
@Autowired
private ActSummaryDao actSummaryDao;
@Autowired
private ActGrantPointLogDao actGrantPointLogDao;
/**
* @return void
* @author yinzuomei
@ -868,6 +869,15 @@ public class WorkActServiceImpl implements WorkActService {
}
mqBaseMsgDTO.setMsg(JSON.toJSONString(basePointEventMsgArrayList));
Result result=SendMqMsgUtils.sendMsg(mqBaseMsgDTO);
ActGrantPointLogEntity actGrantPointLogEntity=new ActGrantPointLogEntity();
actGrantPointLogEntity.setActId(actInfoDTO.getId());
actGrantPointLogEntity.setCustomerId(actInfoDTO.getCustomerId());
actGrantPointLogEntity.setOperatorId(loginUserUtil.getLoginUserId());
actGrantPointLogEntity.setRemark(remark);
actGrantPointLogEntity.setReward(actInfoDTO.getReward());
actGrantPointLogEntity.setSendMsg(JSON.toJSONString(mqBaseMsgDTO));
actGrantPointLogEntity.setResponseMsg(JSON.toJSONString(result));
actGrantPointLogDao.insert(actGrantPointLogEntity);
if(!result.success()){
logger.error("活动积分发放失败");
}
@ -899,6 +909,15 @@ public class WorkActServiceImpl implements WorkActService {
logger.info("发送消息入参:"+JSON.toJSON(mqBaseMsgDTO));
Result result = SendMqMsgUtils.sendMsg(mqBaseMsgDTO);
logger.info("发送消息返参:"+JSON.toJSON(result));
ActGrantPointLogEntity actGrantPointLogEntity=new ActGrantPointLogEntity();
actGrantPointLogEntity.setActId(formDTO.getSourceId());
actGrantPointLogEntity.setCustomerId(formDTO.getCustomerId());
actGrantPointLogEntity.setOperatorId(loginUserUtil.getLoginUserId());
actGrantPointLogEntity.setRemark(formDTO.getRemark());
actGrantPointLogEntity.setReward(formDTO.getReward());
actGrantPointLogEntity.setSendMsg(JSON.toJSONString(mqBaseMsgDTO));
actGrantPointLogEntity.setResponseMsg(JSON.toJSONString(result));
actGrantPointLogDao.insert(actGrantPointLogEntity);
if (!result.success()) {
logger.error("积分发放失败");
return;

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

@ -356,10 +356,12 @@ public class WorkActUserServiceImpl implements WorkActUserService {
//参与活动统计值
HistoricalActInfo historicalActInfo=getHistoricalActInfo(formDTO.getUserId());
resultDTO.setSignInActNum(historicalActInfo.getSignInActNum());
resultDTO.setSignUpActNum(historicalActInfo.getSignUpActNum());
//减去当前的
resultDTO.setSignUpActNum(historicalActInfo.getSignUpActNum()-1);
resultDTO.setObtainPointsActNum(historicalActInfo.getObtainPointsActNum());
//历史活动列表
resultDTO.setActInfoList(actUserRelationDao.selectAllByUserId(formDTO.getUserId()));
List<UserHistoricalActInfoDTO> actInfoList=actUserRelationDao.selectAllByUserId(formDTO.getUserId(),formDTO.getCurrentActId());
resultDTO.setActInfoList(actInfoList);
return resultDTO;
}

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

@ -11,7 +11,7 @@
Target Server Version : 50728
File Encoding : 65001
Date: 28/07/2020 15:17:47
Date: 30/07/2020 14:11:45
*/
SET NAMES utf8mb4;
@ -58,6 +58,28 @@ CREATE TABLE `act_customized` (
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '爱心互助首页自定义配置' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_grant_point_log
-- ----------------------------
DROP TABLE IF EXISTS `act_grant_point_log`;
CREATE TABLE `act_grant_point_log` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`REWARD` int(11) NOT NULL,
`REMARK` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`OPERATOR_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`SEND_MSG` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`RESPONSE_MSG` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`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
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '活动发放积分日志表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for act_info
-- ----------------------------

24
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActGrantPointLogDao.xml

@ -0,0 +1,24 @@
<?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.ActGrantPointLogDao">
<resultMap type="com.epmet.entity.ActGrantPointLogEntity" id="actGrantPointLogMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="actId" column="ACT_ID"/>
<result property="reward" column="REWARD"/>
<result property="remark" column="REMARK"/>
<result property="operatorId" column="OPERATOR_ID"/>
<result property="sendMsg" column="SEND_MSG"/>
<result property="responseMsg" column="RESPONSE_MSG"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

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

@ -137,8 +137,8 @@
</select>
<!-- 根据userId,查询参与活动记录 -->
<select id="selectAllByUserId" resultType="com.epmet.dto.result.work.UserHistoricalActInfoDTO" parameterType="java.lang.String">
SELECT
<select id="selectAllByUserId" resultType="com.epmet.dto.result.work.UserHistoricalActInfoDTO" parameterType="map">
SELECT
acr.ACT_ID AS actId,
ACR.USER_ID AS userId,
ai.TITLE AS title,
@ -148,17 +148,28 @@
acr.REWARD_FLAG AS rewardFlag,
acr.DENY_REWARD_REASON AS denyRewardReason,
acr.PROCESS_FLAG AS processFlag,
(select CREATED_TIME
from act_sign_in_rec ar
where ar.ACT_ID=acr.ACT_ID
and ar.USER_ID=acr.USER_ID
order by ar.CREATED_TIME asc limit 1) as signInTime
(
SELECT
CREATED_TIME
FROM
act_sign_in_rec ar
WHERE
ar.ACT_ID = acr.ACT_ID
AND ar.USER_ID = acr.USER_ID
ORDER BY
ar.CREATED_TIME ASC
LIMIT 1
) AS signInTime,
ai.ACT_STATUS AS actStatus,
acr.STATUS AS userActStatus,
( CASE acr.SIGN_IN_FLAG WHEN 'signed_in' THEN 1 ELSE 0 END ) AS signInFlag
FROM
act_user_relation acr
LEFT JOIN act_info ai ON ( acr.ACT_ID = ai.id )
WHERE
acr.DEL_FLAG = '0'
AND acr.USER_ID = #{userId}
AND acr.USER_ID =#{userId}
and acr.act_id !=#{currentActId}
ORDER BY
acr.CREATED_TIME DESC
</select>
@ -175,6 +186,7 @@
WHERE
aur.DEL_FLAG = '0'
AND aur.PROCESS_FLAG != 'handled'
and aur.`status`='passed'
AND aur.ACT_ID = #{actId}
</select>
@ -291,4 +303,16 @@
AND ( aur.STATUS = 'auditing' OR aur.`STATUS` = 'passed' )
AND aur.ACT_ID = #{actId}
</select>
<!-- 当前用户的状态 -->
<select id="selectUserStatusByActIdAndUserId" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
aur.STATUS
FROM
act_user_relation aur
WHERE
aur.DEL_FLAG = '0'
AND aur.USER_ID = #{userId}
AND aur.ACT_ID = #{actId}
</select>
</mapper>

10
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml

@ -44,4 +44,14 @@
WHERE DEL_FLAG = '0'
AND USER_ID = #{userId}
</update>
<select id="selectVolunteerInfoByUserId" parameterType="java.lang.String" resultType="com.epmet.dto.VolunteerInfoDTO">
SELECT
CUSTOMER_ID customerId,
VOLUNTEER_INTRODUCE volunteerIntroduce,
VOLUNTEER_SIGNATURE volunteerSignature
FROM volunteer_info
WHERE DEL_FLAG = '0'
AND USER_ID = #{userId}
</select>
</mapper>

19
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/constant/HttpUrlConstant.java

@ -0,0 +1,19 @@
package com.epmet.constant;
/**
* @Author zxc
* @CreateTime 2020/7/30 9:47
*/
public interface HttpUrlConstant {
/**
* 定时任务 刷新authorizer_access_tokenurl
*/
String AUTH_ACCESS_TOKEN_URL = "https://epmet-cloud.elinkservice.cn/api/third/wechatthird/refreshtoken";
/**
* 定时任务 刷新component_access_tokenurl
*/
String COMPONENT_ACCESS_TOKEN_URL = "https://epmet-cloud.elinkservice.cn/api/third/wechatthird/componentaccesstoken";
}

14
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ComponentAccessTokenServiceImpl.java

@ -1,6 +1,11 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.HttpUrlConstant;
import com.epmet.feign.EpmetThirdFeignClient;
import com.epmet.service.ComponentAccessTokenService;
import lombok.extern.slf4j.Slf4j;
@ -15,11 +20,12 @@ import org.springframework.stereotype.Service;
@Service
public class ComponentAccessTokenServiceImpl implements ComponentAccessTokenService {
@Autowired
private EpmetThirdFeignClient epmetThirdFeignClient;
@Override
public Result componentAccessTokenJob() {
return epmetThirdFeignClient.getComponentAccessTokenJob();
JSONObject jsonObject = new JSONObject();
String data = HttpClientManager.getInstance().sendPostByJSON(HttpUrlConstant.COMPONENT_ACCESS_TOKEN_URL, JSON.toJSONString(jsonObject)).getData();
JSONObject toResult = JSON.parseObject(data);
Result result = ConvertUtils.mapToEntity(toResult, Result.class);
return result;
}
}

14
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/RefreshAuthAccessTokenServiceImpl.java

@ -1,6 +1,11 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.HttpUrlConstant;
import com.epmet.feign.EpmetThirdFeignClient;
import com.epmet.service.RefreshAuthAccessTokenService;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,11 +18,12 @@ import org.springframework.stereotype.Service;
@Service
public class RefreshAuthAccessTokenServiceImpl implements RefreshAuthAccessTokenService {
@Autowired
private EpmetThirdFeignClient epmetThirdFeignClient;
@Override
public Result refreshAuthorizerAccessTokenJob() {
return epmetThirdFeignClient.refreshAuthorizerAccessTokenJob();
JSONObject jsonObject = new JSONObject();
String data = HttpClientManager.getInstance().sendPostByJSON(HttpUrlConstant.AUTH_ACCESS_TOKEN_URL, JSON.toJSONString(jsonObject)).getData();
JSONObject toResult = JSON.parseObject(data);
Result result = ConvertUtils.mapToEntity(toResult, Result.class);
return result;
}
}

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

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

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

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

4
epmet-module/epmet-point/epmet-point-server/src/main/resources/db/migration/epmet_point.sql

@ -37,3 +37,7 @@ CREATE TABLE rule_operate_log(
UPDATED_TIME DATETIME COMMENT '更新时间' ,
PRIMARY KEY (ID)
) COMMENT = '积分规则操作记录表';
INSERT INTO `epmet_point`.`point_rule`(`ID`, `CUSTOMER_ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', '3ef7e4bb195eb9e622d68b52509aa940', '注册志愿者', '认证志愿者会获得积分', 'register_volunteer', '43addd0735230c01eedbb38d721076b0', 'plus', 0, '', 10, 'time', '1', '0', 0, 'APP_USER', '2020-07-23 14:48:56', 'APP_USER', '2020-07-23 14:48:56');
INSERT INTO `epmet_point`.`point_rule`(`ID`, `CUSTOMER_ID`, `RULE_NAME`, `RULE_DESC`, `EVENT_CODE`, `FUNCTION_ID`, `OPERATE_TYPE`, `UP_LIMIT`, `UP_LIMIT_DESC`, `POINT`, `POINT_UNIT`, `ENABLED_FLAG`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', '3ef7e4bb195eb9e622d68b52509aa940', '发布实况', '发布实况获得积分', 'publist_active_live', '43addd0735230c01eedbb38d721076b0', 'plus', 0, '', 10, 'time', '1', '0', 0, 'APP_USER', '2020-07-23 14:48:56', 'APP_USER', '2020-07-23 14:48:56');

27
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CheckPaUserFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 公众号-发送短信验证码-接口入参
* @Author sun
*/
@Data
public class CheckPaUserFormDTO implements Serializable {
private static final long serialVersionUID = -6163303184086480522L;
/**
* s手机号
*/
private String phone;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
private String source;
}

12
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterByAuthFormDTO.java

@ -1,7 +1,9 @@
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;
/**
@ -12,10 +14,20 @@ import java.io.Serializable;
public class RegisterByAuthFormDTO implements Serializable {
private static final long serialVersionUID = -6547893374373422628L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
/**
* 初始化状态0:已初始化1:未初始化
* */
private Integer initState;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
@NotBlank(message = "数据来源不能为空", groups = {RegisterByAuthFormDTO.AddUserInternalGroup.class, RegisterByAuthFormDTO.AddUserShowGroup.class})
private String source;
}

5
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterFormDTO.java

@ -51,4 +51,9 @@ public class RegisterFormDTO implements Serializable {
*/
private String userId;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
private String source;
}

9
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterInfoFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.Min;
@ -17,6 +18,8 @@ public class RegisterInfoFormDTO implements Serializable {
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
/**
* 当前页
@ -29,4 +32,10 @@ public class RegisterInfoFormDTO implements Serializable {
* */
private Integer pageSize = 20;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
@NotBlank(message = "数据来源不能为空", groups = {RegisterInfoFormDTO.AddUserInternalGroup.class, RegisterInfoFormDTO.AddUserShowGroup.class})
private String source;
}

6
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveUserVisitedFormDTO.java

@ -31,4 +31,10 @@ public class SaveUserVisitedFormDTO implements Serializable {
*/
private String phone;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
private String source;
}

28
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WxCodeToTokenFormDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.form;
import lombok.Data;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import java.io.Serializable;
import java.util.Date;
/**
* 公众号-wxcode换取token保存微信用户信息-接口入参
* @Author sun
*/
@Data
public class WxCodeToTokenFormDTO implements Serializable {
private static final long serialVersionUID = -6163303184086480522L;
/**
* 微信用户信息
*/
private WxMpUser wxMpUser;
/**
* 数据来源(dev:开发 test:体验 prod:生产)
*/
private String source;
}

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.79
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.80
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.79</version>
<version>0.0.80</version>
<parent>
<groupId>com.epmet</groupId>

10
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java

@ -61,25 +61,27 @@ public class PaCustomerController {
/**
* @param formDTO
* @param source 服务端类型 dev:开发 test:体验 prod:生产
* @return
* @Author sun
* @Description 公众号-创建组织
**/
@PostMapping("createagency")
public Result<CreateAgencyResultDTO> createAgency(@LoginUser TokenDto tokenDTO, @RequestBody CreateAgencyFormDTO formDTO) {
public Result<CreateAgencyResultDTO> createAgency(@LoginUser TokenDto tokenDTO, @RequestBody CreateAgencyFormDTO formDTO,@RequestHeader("source")String source) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
return new Result<CreateAgencyResultDTO>().ok(paCustomerService.createAgency(tokenDTO, formDTO));
return new Result<CreateAgencyResultDTO>().ok(paCustomerService.createAgency(tokenDTO, formDTO,source));
}
/**
* @param tokenDTO
* @param source 服务端类型 dev:开发 test:体验 prod:生产
* @return
* @Author sun
* @Description 公众号-查询我的信息
**/
@PostMapping("myinfo")
public Result<MyInfoResultDTO> myInfo(@LoginUser TokenDto tokenDTO) {
return new Result<MyInfoResultDTO>().ok(paCustomerService.myInfo(tokenDTO));
public Result<MyInfoResultDTO> myInfo(@LoginUser TokenDto tokenDTO,@RequestHeader("source")String source) {
return new Result<MyInfoResultDTO>().ok(paCustomerService.myInfo(tokenDTO,source));
}
/**

17
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java

@ -23,14 +23,15 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.form.CheckPaUserFormDTO;
import com.epmet.dto.form.WxCodeToTokenFormDTO;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.excel.PaUserExcel;
import com.epmet.service.PaUserService;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -95,25 +96,25 @@ public class PaUserController {
}
/**
* @param wxMpUser
* @param formDTO
* @return
* @Author sun
* @Description 根据openId新增或更新用户信息
**/
@PostMapping(value = "/saveuser")
public Result<SaveUserResultDTO> saveUser(@RequestBody WxMpUser wxMpUser) {
return new Result<SaveUserResultDTO>().ok(paUserService.saveUser(wxMpUser));
public Result<SaveUserResultDTO> saveUser(@RequestBody WxCodeToTokenFormDTO formDTO) {
return new Result<SaveUserResultDTO>().ok(paUserService.saveUser(formDTO));
}
/**
* @param phone
* @param formDTO
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
**/
@PostMapping(value = "/checkpauser/{phone}")
public Result<CustomerUserResultDTO> checkPaUser(@PathVariable("phone") String phone) {
return new Result<CustomerUserResultDTO>().ok(paUserService.checkPaUser(phone));
public Result<CustomerUserResultDTO> checkPaUser(@RequestBody CheckPaUserFormDTO formDTO) {
return new Result<CustomerUserResultDTO>().ok(paUserService.checkPaUser(formDTO));
}
}

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

@ -49,9 +49,9 @@ public interface CustomerMpDao extends BaseDao<CustomerMpEntity> {
* @param
* @return
* @Author sun
* @Description 查询所有客户小程序的授权信息
* @Description 根据数据来源查询所有客户小程序的授权信息
**/
List<CustomerMpDTO> selectAll();
List<CustomerMpDTO> selectAll(@Param("source")String source);
/**
* @Description 查询授权的数量

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

@ -49,9 +49,9 @@ public interface PaCustomerDao extends BaseDao<PaCustomerEntity> {
* @param
* @return
* @Author sun
* @Description 查询公众号注册的客户信息列表
* @Description 根据数据来源查询公众号注册的客户信息列表
**/
List<CustomerAgencyResultDTO> registerInfo();
List<CustomerAgencyResultDTO> registerInfo(@Param("source") String source);
/**
* @param dto

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

@ -38,5 +38,13 @@ public interface PaCustomerUserAgencyDao extends BaseDao<PaCustomerUserAgencyEnt
* @Author sun
* @Description 根据userId查询客户信息
**/
PaCustomerUserAgencyDTO selectByUserId(@Param("userId") String userId);
PaCustomerUserAgencyDTO selectByUserId(@Param("userId") String userId, @Param("source")String source);
/**
* @param userId
* @return
* @Author sun
* @Description 根据userId查询客户信息
**/
PaCustomerUserAgencyDTO selectCustomerIdByUserId(@Param("userId") String userId);
}

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

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.form.CheckPaUserFormDTO;
import com.epmet.entity.PaUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -35,12 +36,12 @@ import java.util.List;
public interface PaUserDao extends BaseDao<PaUserEntity> {
/**
* @param phone
* @param phone source
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
* @Description 根据数据来源和手机号查询公众号用户基本信息校验用户是否存在
**/
List<PaUserDTO> selectUserByPhone(@Param("phone") String phone);
List<PaUserDTO> selectUserByPhone(@Param("phone") String phone, @Param("source") String source);
/**
* @param customerId
@ -49,4 +50,12 @@ public interface PaUserDao extends BaseDao<PaUserEntity> {
* @Description 根据客户Id级联查询客户管理员注册信息
**/
PaUserDTO selectPaUser(@Param("customerId") String customerId);
/**
* @param id source
* @return
* @Author sun
* @Description 根据数据来源和手机号查询公众号用户基本信息校验用户是否存在
**/
PaUserDTO selectUser(@Param("id") String id, @Param("source") String source);
}

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java

@ -36,7 +36,7 @@ public interface PaUserVisitedDao extends BaseDao<PaUserVisitedEntity> {
* @param openId
* @return
* @Author sun
* @Description 根据openId查询登陆访问记录数据按时间倒序
* @Description 根据数据来源和openId查询登陆访问记录数据按时间倒序
**/
PaUserVisitedDTO selectByOpenId(@Param("openId") String openId);
PaUserVisitedDTO selectByOpenId(@Param("openId") String openId, @Param("source") String source);
}

4
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java

@ -38,9 +38,9 @@ public interface PaUserWechatDao extends BaseDao<PaUserWechatEntity> {
* @param openId
* @return
* @Author sun
* @Description 根据openId查询user_wechat表信息
* @Description 根据数据来源和openId查询user_wechat表信息
**/
List<PaUserWechatDTO> selectWechatByOpenId(@Param("openId") String openId);
List<PaUserWechatDTO> selectWechatByOpenId(@Param("openId") String openId, @Param("source") String source);
/**
* @param dto

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

@ -116,19 +116,21 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
/**
* @param formDTO
* @param source 服务端类型 dev:开发 test:体验 prod:生产
* @return
* @Author sun
* @Description 公众号-创建组织
**/
CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO);
CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO,String source);
/**
* @param tokenDTO
* @param source 服务端类型 dev:开发 test:体验 prod:生产
* @return
* @Author sun
* @Description 公众号-查询我的信息
**/
MyInfoResultDTO myInfo(TokenDto tokenDTO);
MyInfoResultDTO myInfo(TokenDto tokenDTO,String source);
/**
* @param formDTO

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

@ -20,10 +20,11 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.form.CheckPaUserFormDTO;
import com.epmet.dto.form.WxCodeToTokenFormDTO;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.entity.PaUserEntity;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import java.util.List;
import java.util.Map;
@ -97,18 +98,18 @@ public interface PaUserService extends BaseService<PaUserEntity> {
void delete(String[] ids);
/**
* @param wxMpUser
* @param formDTO
* @return
* @Author sun
* @Description 根据openId新增或更新用户信息
**/
SaveUserResultDTO saveUser(WxMpUser wxMpUser);
SaveUserResultDTO saveUser(WxCodeToTokenFormDTO formDTO);
/**
* @param phone
* @param formDTO
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
* @Description 根据数据来源和手机号查询公众号用户基本信息校验用户是否存在
**/
CustomerUserResultDTO checkPaUser(String phone);
CustomerUserResultDTO checkPaUser(CheckPaUserFormDTO formDTO);
}

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

@ -97,7 +97,7 @@ public interface PaUserWechatService extends BaseService<PaUserWechatEntity> {
* @param openId
* @return
* @Author sun
* @Description 根据openId查询user_wechat表信息
* @Description 根据数据来源和openId查询user_wechat表信息
**/
List<PaUserWechatDTO> getWechatByOpenId(String openId);
List<PaUserWechatDTO> getWechatByOpenId(String openId, String source);
}

10
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java

@ -5,12 +5,12 @@ import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.ModuleConstant;
import com.epmet.dao.BindingAccountDao;
import com.epmet.dao.CustomerMpDao;
import com.epmet.dao.OpenPlatformAccountDao;
import com.epmet.dao.PaCustomerAgencyDao;
import com.epmet.dto.form.GoToAuthFormDTO;
import com.epmet.dto.form.OpenAppIdFormDTO;
import com.epmet.dto.form.RemoveBindFormDTO;
@ -35,13 +35,9 @@ import java.util.Map;
@Service
public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationService {
@Autowired
private PaCustomerAgencyDao paCustomerAgencyDao;
@Autowired
private ComponentVerifyTicketService componentVerifyTicketService;
@Autowired
private ComponentVerifyTicketServiceImpl componentVerifyTicketServiceImpl;
@Autowired
private OpenPlatformAccountDao openPlatformAccountDao;
@Autowired
private CustomerMpDao customerMpDao;
@ -85,7 +81,7 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic
//查询appId
String authAppId = customerMpDao.getAppId(customerId, clientType);
Map<String, Object> authInfo = redisThird.getAuthInfo(customerId, clientType);
AuthorizationInfoResultDTO authorizationInfo = componentVerifyTicketServiceImpl.mapToEntity(authInfo, AuthorizationInfoResultDTO.class);
AuthorizationInfoResultDTO authorizationInfo = ConvertUtils.mapToEntity(authInfo, AuthorizationInfoResultDTO.class);
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId);
jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId);
@ -110,7 +106,7 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic
String clientType = formDTO.getClientType();
String authAppId = customerMpDao.getAppId(customerId, clientType);
Map<String, Object> authInfo = redisThird.getAuthInfo(customerId, clientType);
AuthorizationInfoResultDTO authorizationInfo = componentVerifyTicketServiceImpl.mapToEntity(authInfo, AuthorizationInfoResultDTO.class);
AuthorizationInfoResultDTO authorizationInfo = ConvertUtils.mapToEntity(authInfo, AuthorizationInfoResultDTO.class);
JSONObject jsonObject = new JSONObject();
jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId);
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.UN_BIND + authorizationInfo.getAuthorizer_access_token(), JSON.toJSONString(jsonObject)).getData();

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

@ -6,6 +6,7 @@ import com.alibaba.nacos.client.config.utils.IOUtils;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdRedisKeyConstant;
@ -31,7 +32,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.*;
import static com.epmet.constant.ModuleConstant.COMPONENT_ACCESS_TOKEN;
@ -175,7 +175,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
public void disposeAuthResult(Map<String,String> result){
Map tempMap = result;
Map<String,Object> data = tempMap;
AuthResultRecordFormDTO authResultRecord = mapToEntity(data, AuthResultRecordFormDTO.class);
AuthResultRecordFormDTO authResultRecord = ConvertUtils.mapToEntity(data, AuthResultRecordFormDTO.class);
authResultRecord.setWechatCreateTime(this.sToDate(result.get(ModuleConstant.CREATE_TIME)));
if (result.containsKey(ModuleConstant.AUTHORIZATION_CODE_EXPIRED_TIME)) {
authResultRecord.setExpiredTime(this.sToDate(result.get(ModuleConstant.AUTHORIZATION_CODE_EXPIRED_TIME)));
@ -285,7 +285,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
String authInfo = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_QUERY_AUTH_URL + accessToken, JSON.toJSONString(jsonObject)).getData();
HashMap<String,Map> hashMap = JSON.parseObject(authInfo, HashMap.class);
Map map = hashMap.get(ModuleConstant.AUTHORIZATION_INFO);
authorizationInfoResultDTO = mapToEntity(map, AuthorizationInfoResultDTO.class);
authorizationInfoResultDTO = ConvertUtils.mapToEntity(map, AuthorizationInfoResultDTO.class);
String authAppId = authorizationInfoResultDTO.getAuthorizer_appid();
log.info("授权信息:"+map);
String expiresIn = authorizationInfoResultDTO.getExpires_in().toString();
@ -433,7 +433,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
boolean keyExist = authorizerInfo.containsKey(ModuleConstant.MINI_PROGRAM_INFO);
if (keyExist == true){
log.info("授权方为小程序 并 开始插入信息");
MiniInfoFormDTO miniInfoFormDTO = this.mapToEntity(authorizerInfo, MiniInfoFormDTO.class);
MiniInfoFormDTO miniInfoFormDTO = ConvertUtils.mapToEntity(authorizerInfo, MiniInfoFormDTO.class);
miniInfoFormDTO.setCustomerId(customerId);
miniInfoFormDTO.setClientType(clientType);
//基础信息插入
@ -485,7 +485,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
}
}else {
log.info("授权方为公众号 并 开始插入信息");
PaInfoFormDTO paInfoFormDTO = this.mapToEntity(authorizerInfo, PaInfoFormDTO.class);
PaInfoFormDTO paInfoFormDTO = ConvertUtils.mapToEntity(authorizerInfo, PaInfoFormDTO.class);
//公众号基本信息插入
paInfoDao.insertPaInfo(paInfoFormDTO);
String primaryId = paInfoFormDTO.getId();
@ -611,36 +611,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
}
}
/**
* @Description map Entity
* @param map
* @param entity
* @author zxc
*/
public <T> T mapToEntity(Map<String, Object> map, Class<T> entity) {
T t = null;
try {
t = entity.newInstance();
for(Field field : entity.getDeclaredFields()) {
if (map.containsKey(field.getName())) {
boolean flag = field.isAccessible();
field.setAccessible(true);
Object object = map.get(field.getName());
if (object!= null && field.getType().isAssignableFrom(object.getClass())) {
field.set(t, object);
}
field.setAccessible(flag);
}
}
return t;
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return t;
}
/**
* @Description 转换过期时间
* @param expiresIn
@ -660,7 +630,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
* @author zxc
*/
public String getLoginUserCustomerId(TokenDto tokenDto){
PaCustomerUserAgencyDTO result = paCustomerUserAgencyDao.selectByUserId(tokenDto.getUserId());
PaCustomerUserAgencyDTO result = paCustomerUserAgencyDao.selectCustomerIdByUserId(tokenDto.getUserId());
return result.getCustomerId();
}

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

@ -164,21 +164,21 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//1.根据手机号查询到用户信息,判断用户是否存
List<PaUserDTO> userList = paUserDao.selectUserByPhone(formDTO.getPhone());
//1.根据数据来源和手机号查询到用户信息,判断用户是否存
List<PaUserDTO> userList = paUserDao.selectUserByPhone(formDTO.getPhone(), formDTO.getSource());
if (null != userList && userList.size() > NumConstant.ZERO) {
throw new RenException(EpmetErrorCode.MOBILE_USED.getCode());
}
//2.根据token中的userId查询pa_user表数据,根据手机号是否为空判断后续是新增还是更新user数据
PaUserEntity paUserEntity = paUserDao.selectById(formDTO.getUserId());
if (null == paUserEntity) {
logger.error("根据token中userId查询pa_user表信息失败,userId->"+formDTO.getUserId());
//2.根据数据来源和token中的userId查询pa_user表数据,根据手机号是否为空判断后续是新增还是更新user数据
PaUserDTO paUserDTO= paUserDao.selectUser(formDTO.getUserId(), formDTO.getSource());
if (null == paUserDTO) {
logger.error("根据数据来源和token中userId查询pa_user表信息失败,数据来源->" + formDTO.getSource() + ",userId->" + formDTO.getUserId());
throw new RenException(PaConstant.SELECT_USER_EXCEPTION);
}
//3.手机号不为空说明是同一个微信用户用第二个手机号注册,手机为空说明当前微信用户用第一个手机号注册
if(StringUtils.isNotBlank(paUserEntity.getPhone())){
if(StringUtils.isNotBlank(paUserDTO.getPhone())){
//手机号不为空说明是同一个微信用户用第二个手机号注册,新增user和user_wechat表数据
//3-1.user表新增数据
PaUserEntity userEntity = new PaUserEntity();
@ -289,17 +289,19 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
/**
* @param formDTO
* @param source 服务端类型 dev:开发 test:体验 prod:生产
* @return
* @Author sun
* @Description 公众号-创建组织
**/
@Override
@Transactional(rollbackFor = Exception.class)
public CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO) {
public CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO,String source) {
//1.客户表初始化数据
PaCustomerEntity entity = new PaCustomerEntity();
entity.setIsInitialize(NumConstant.ZERO);
entity.setCustomerName(formDTO.getAgencyName());
entity.setSource(source);
baseDao.insert(entity);
//2.客户组织表初始化数据
@ -356,15 +358,16 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
/**
* @param tokenDTO
* @param source 服务端类型 dev:开发 test:体验 prod:生产
* @return
* @Author sun
* @Description 公众号-查询我的信息
**/
@Override
public MyInfoResultDTO myInfo(TokenDto tokenDTO) {
public MyInfoResultDTO myInfo(TokenDto tokenDTO,String source) {
//0.根据token中userId查询对应的客户Id,客户Id没有则表示用户没有填写过组织信息,需要继续完善信息
PaCustomerUserAgencyDTO dto = paCustomerUserAgencyDao.selectByUserId(tokenDTO.getUserId());
PaCustomerUserAgencyDTO dto = paCustomerUserAgencyDao.selectByUserId(tokenDTO.getUserId(),source);
if (null == dto || null == dto.getCustomerId()) {
return new MyInfoResultDTO();
}
@ -408,9 +411,9 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
//分页参数
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
//1.查询客户组织信息
List<CustomerAgencyResultDTO> list = baseDao.registerInfo();
List<CustomerAgencyResultDTO> list = baseDao.registerInfo(formDTO.getSource());
//2.查询客户小程序授权信息
List<CustomerMpDTO> mpList = customerMpDao.selectAll();
List<CustomerMpDTO> mpList = customerMpDao.selectAll(formDTO.getSource());
//3.封装数据
list.forEach(l -> {
mpList.forEach(mp -> {

35
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java

@ -34,12 +34,16 @@ import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.PaUserVisitedDTO;
import com.epmet.dto.PaUserWechatDTO;
import com.epmet.dto.form.CheckPaUserFormDTO;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.dto.form.WxCodeToTokenFormDTO;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.entity.PaUserEntity;
import com.epmet.entity.PaUserWechatEntity;
import com.epmet.redis.PaUserRedis;
import com.epmet.service.PaUserService;
import com.epmet.service.PaUserVisitedService;
import com.epmet.service.PaUserWechatService;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.apache.commons.lang3.StringUtils;
@ -72,6 +76,8 @@ public class PaUserServiceImpl extends BaseServiceImpl<PaUserDao, PaUserEntity>
private PaUserWechatDao paUserWechatDao;
@Autowired
private PaUserVisitedDao paUserVisitedDao;
@Autowired
private PaUserVisitedService paUserVisitedService;
@Override
public PageData<PaUserDTO> page(Map<String, Object> params) {
@ -126,22 +132,24 @@ public class PaUserServiceImpl extends BaseServiceImpl<PaUserDao, PaUserEntity>
}
/**
* @param wxMpUser
* @param formDTO
* @return
* @Author sun
* @Description 根据openId新增或更新用户信息
**/
@Override
@Transactional(rollbackFor = Exception.class)
public SaveUserResultDTO saveUser(WxMpUser wxMpUser) {
public SaveUserResultDTO saveUser(WxCodeToTokenFormDTO formDTO) {
WxMpUser wxMpUser = formDTO.getWxMpUser();
SaveUserResultDTO resultDTO = new SaveUserResultDTO();
//1.根据openId查询user_wechat表是否存在用户信息(user表和user_wechat表数据多对多关系)
List<PaUserWechatDTO> wechatDTO = paUserWechatService.getWechatByOpenId(wxMpUser.getOpenId());
//1.根据openId查询user_wechat表是否存在用户信息(user表和user_wechat表数据多对多关系)
List<PaUserWechatDTO> wechatDTO = paUserWechatService.getWechatByOpenId(wxMpUser.getOpenId(), formDTO.getSource());
//2.不存在则新增用户信息,存在则更新user_wechat表信息
if (null == wechatDTO || wechatDTO.size() < NumConstant.ONE) {
//2.1、user表新增数据
PaUserEntity userEntity = new PaUserEntity();
userEntity.setSource(formDTO.getSource());
baseDao.insert(userEntity);
//2.2、user_wechat表新增数据
PaUserWechatEntity wechatEntity = new PaUserWechatEntity();
@ -157,9 +165,16 @@ public class PaUserServiceImpl extends BaseServiceImpl<PaUserDao, PaUserEntity>
wechatEntity.setLanguage(null == wxMpUser.getLanguage() ? "" : wxMpUser.getLanguage());
paUserWechatService.insert(wechatEntity);
//2.3、pa_user_visited表新增访问记录数据
SaveUserVisitedFormDTO visited = new SaveUserVisitedFormDTO();
visited.setUserId(userEntity.getId());
visited.setLogonUserId(userEntity.getId());
visited.setSource(formDTO.getSource());
paUserVisitedService.saveUserVisited(visited);
resultDTO.setUserId(userEntity.getId());
} else {
//2.3、批量更新user_wechat表数据
//2.4、批量更新user_wechat表数据
List<PaUserWechatEntity> wechatEntity = ConvertUtils.sourceToTarget(wechatDTO, PaUserWechatEntity.class);
for(PaUserWechatEntity entity : wechatEntity){
entity.setGender(wxMpUser.getSex().toString());
@ -172,8 +187,8 @@ public class PaUserServiceImpl extends BaseServiceImpl<PaUserDao, PaUserEntity>
}
paUserWechatService.updateBatchById(wechatEntity);
//2.4、根据openid查询用户登陆访问记录表数据,按登陆时间倒序
PaUserVisitedDTO visitedDTO = paUserVisitedDao.selectByOpenId(wxMpUser.getOpenId());
//2.5、根据openid查询用户登陆访问记录表数据,按登陆时间倒序
PaUserVisitedDTO visitedDTO = paUserVisitedDao.selectByOpenId(wxMpUser.getOpenId(), formDTO.getSource());
if (null == visitedDTO || "".equals(visitedDTO.getUserId())) {
logger.error("根据openid查询用户访问记录表数据失败,openid->"+wxMpUser.getOpenId());
throw new RenException(PaConstant.SELECT_VISITED_EXCEPTION);
@ -187,16 +202,16 @@ public class PaUserServiceImpl extends BaseServiceImpl<PaUserDao, PaUserEntity>
}
/**
* @param phone
* @param formDTO
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
**/
@Override
public CustomerUserResultDTO checkPaUser(String phone) {
public CustomerUserResultDTO checkPaUser(CheckPaUserFormDTO formDTO) {
CustomerUserResultDTO resultDTO = new CustomerUserResultDTO();
//1.根据手机号查询用户信息
List<PaUserDTO> userList = baseDao.selectUserByPhone(phone);
List<PaUserDTO> userList = baseDao.selectUserByPhone(formDTO.getPhone(), formDTO.getSource());
if (null == userList || userList.size() < NumConstant.ONE) {
resultDTO.setPaUserResult(null);
resultDTO.setPaCustomerResult(null);

1
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java

@ -135,6 +135,7 @@ public class PaUserVisitedServiceImpl extends BaseServiceImpl<PaUserVisitedDao,
entity.setWxOpenId(userEntity.getWxOpenId());
entity.setOpenId(openId);
entity.setPhone(visited.getPhone());
entity.setSource(visited.getSource());
baseDao.insert(entity);
}

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java

@ -105,11 +105,11 @@ public class PaUserWechatServiceImpl extends BaseServiceImpl<PaUserWechatDao, Pa
* @param openId
* @return
* @Author sun
* @Description 根据openId查询user_wechat表信息
* @Description 根据数据来源和openId查询user_wechat表信息
**/
@Override
public List<PaUserWechatDTO> getWechatByOpenId(String openId) {
return baseDao.selectWechatByOpenId(openId);
public List<PaUserWechatDTO> getWechatByOpenId(String openId, String source) {
return baseDao.selectWechatByOpenId(openId, source);
}
}

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

@ -1,6 +1,7 @@
package com.epmet.service.impl;
import com.alibaba.nacos.client.config.utils.IOUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.ModuleConstant;
import com.epmet.constant.ThirdRunTimeInfoConstant;
import com.epmet.dao.*;
@ -44,8 +45,6 @@ public class WarrantServiceImpl implements WarrantService {
@Value("${third.platform.token}")
private String token;
@Autowired
private ComponentVerifyTicketServiceImpl componentVerifyTicketService;
@Autowired
private CodeAuditRecordDao codeAuditRecordDao;
@Autowired
private MiniInfoDao miniInfoDao;
@ -96,7 +95,7 @@ public class WarrantServiceImpl implements WarrantService {
if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.EVENT_LOW)) {
// TODO 目前来看,msgType = ‘event’ 的是代码审核结果
Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString());
CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(xml, CodeAuditRecordFormDTO.class);
CodeAuditRecordFormDTO codeAuditRecord = ConvertUtils.mapToEntity(xml, CodeAuditRecordFormDTO.class);
codeAuditRecord.setWechatCreateTime(componentVerifyTicketServiceImpl.sToDate(createTime.toString()));
String toUserName = codeAuditRecord.getToUserName();//小程序原始ID
CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName);
@ -130,7 +129,7 @@ public class WarrantServiceImpl implements WarrantService {
codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult);
}else if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.TEXT)){
// TODO 公众号回复消息
MessagePushTextFormDTO messagePushTextFormDTO = componentVerifyTicketService.mapToEntity(xml, MessagePushTextFormDTO.class);
MessagePushTextFormDTO messagePushTextFormDTO = ConvertUtils.mapToEntity(xml, MessagePushTextFormDTO.class);
Object createTime = xml.get(ModuleConstant.CREATE_TIME);
Date date = componentVerifyTicketServiceImpl.sToDate(createTime.toString());
messagePushTextFormDTO.setWeChatCreateTime(date);

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaCategoryResult.java

@ -16,26 +16,32 @@ public class WxMaCategoryResult implements Serializable {
/**
* 一级类目名称
*/
@SerializedName("first_class")
private String firstClass;
/**
* 二级类目名称
*/
@SerializedName("second_class")
private String secondClass;
/**
* 三级类目名称
*/
@SerializedName("third_class")
private String thirdClass;
/**
* 一级类目的ID编号
*/
@SerializedName("first_id")
private String firstId;
/**
* 二级类目的ID编号
*/
@SerializedName("second_id")
private String secondId;
/**
* 三级类目的ID编号
*/
@SerializedName("third_id")
private String thirdId;
}

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

@ -61,17 +61,21 @@
<select id="selectAll" resultType="com.epmet.dto.CustomerMpDTO">
SELECT
id,
customer_id,
client,
app_id,
authorization_flag
cm.id,
cm.customer_id,
cm.client,
cm.app_id,
cm.authorization_flag
FROM
customer_mp
customer_mp cm
INNER JOIN pa_customer pc ON cm.customer_id = pc.id
WHERE
del_flag = '0'
cm.del_flag = '0'
AND pc.del_flag = '0'
AND pc.source = '#{source}'
ORDER BY
customer_id ASC, client ASC
cm.customer_id ASC,
cm.client ASC
</select>
<select id="selectAuthFlag" resultType="java.lang.Boolean">
SELECT

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

@ -52,6 +52,7 @@
WHERE
pca.del_flag = '0'
AND pc.del_flag = '0'
AND pc.source = #{source}
ORDER BY
pca.CREATED_TIME DESC
</select>
@ -64,6 +65,7 @@
pa_customer
WHERE
del_flag = '0'
AND source = #{source}
<if test='null != initState and "" != initState'>
AND is_initialize = #{initState}
</if>

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

@ -5,15 +5,33 @@
<select id="selectByUserId" resultType="com.epmet.dto.PaCustomerUserAgencyDTO">
SELECT
id,
customer_id,
agency_id,
user_id
pcua.id,
pcua.customer_id,
pcua.agency_id,
pcua.user_id
FROM
pa_customer_user_agency
pa_customer_user_agency pcua
LEFT JOIN pa_user pu ON pu.id = pcua.user_id
WHERE
del_flag = '0'
AND user_id = #{userId}
pcua.del_flag = '0'
AND pu.del_flag = '0'
AND pcua.user_id = #{userId}
AND pu.source = #{source}
</select>
<select id="selectCustomerIdByUserId" resultType="com.epmet.dto.PaCustomerUserAgencyDTO">
SELECT
pcua.id,
pcua.customer_id,
pcua.agency_id,
pcua.user_id
FROM
pa_customer_user_agency pcua
LEFT JOIN pa_user pu ON pu.id = pcua.user_id
WHERE
pcua.del_flag = '0'
AND pu.del_flag = '0'
AND pcua.user_id = #{userId}
</select>
</mapper>

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

@ -8,12 +8,14 @@
id,
phone,
real_name,
gender
gender,
source
FROM
pa_user
WHERE
del_flag = '0'
AND phone = #{phone}
AND source = #{source}
</select>
<select id="selectPaUser" resultType="com.epmet.dto.PaUserDTO">
@ -33,4 +35,19 @@
LIMIT 1
</select>
<select id="selectUser" resultType="com.epmet.dto.PaUserDTO">
SELECT
id,
phone,
real_name,
gender,
source
FROM
pa_user
WHERE
del_flag = '0'
AND id = #{id}
AND source = #{source}
</select>
</mapper>

4
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserVisitedDao.xml

@ -9,11 +9,13 @@
user_id,
wx_open_id,
open_id,
phone
phone,
source
FROM
pa_user_visited
WHERE
del_flag = '0'
AND source = #{source}
AND wx_open_id = #{openId}
ORDER BY
created_time DESC

31
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserWechatDao.xml

@ -5,22 +5,25 @@
<select id="selectWechatByOpenId" resultType="com.epmet.dto.PaUserWechatDTO">
SELECT
id,
user_id,
wx_open_id,
union_id,
gender,
nickname,
head_img_url,
country,
province,
city,
`language`
puw.id,
puw.user_id,
puw.wx_open_id,
puw.union_id,
puw.gender,
puw.nickname,
puw.head_img_url,
puw.country,
puw.province,
puw.city,
puw.`language`
FROM
pa_user_wechat
pa_user_wechat puw
INNER JOIN pa_user pu ON puw.user_id = pu.id
WHERE
del_flag = '0'
AND wx_open_id = #{openId}
puw.del_flag = '0'
AND pu.del_flag = '0'
AND pu.source = #{source}
AND puw.wx_open_id = #{openId}
</select>
<select id="selectWechatByUserId" resultType="com.epmet.entity.PaUserWechatEntity">

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

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

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

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.55</version>
<version>0.3.56</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>oper-crm</artifactId>

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

@ -18,6 +18,7 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -27,6 +28,7 @@ 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.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.RoleKeyConstants;
import com.epmet.constant.UserWorkType;
@ -402,11 +404,12 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
@Transactional(rollbackFor = Exception.class)
public void init(CustomerInitFormDTO formDTO) {
//1.调用epmet-third服务,根据客户Id查询第三方服务中的客户、组织、管理员等信息
Result<InitCustomerResultDTO> thirdResult = epmetThirdFeignClient.getCustomerAgencyUser(formDTO.getCustomerId());
String url = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/getcustomeragencyuser/" + formDTO.getCustomerId();
Result<String> thirdResult = HttpClientManager.getInstance().sendPostByJSON(url, null);
if (!thirdResult.success()) {
throw new RenException(thirdResult.getCode(), thirdResult.getInternalMsg());
}
InitCustomerResultDTO initCustomer = thirdResult.getData();
InitCustomerResultDTO initCustomer = JSONObject.parseObject(thirdResult.getData(), InitCustomerResultDTO.class);
PaCustomerDTO paCustomer = initCustomer.getPaCustomer();
PaCustomerAgencyDTO paAgency = initCustomer.getPaAgency();
PaUserDTO paUser = initCustomer.getPaUser();
@ -486,7 +489,8 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
}
//6.更新第三方数据库中客户数据状态为已初始化
Result customerResult = epmetThirdFeignClient.updateCustomer(formDTO.getCustomerId());
String customerUrl = "https://epmet-cloud.elinkservice.cn/api/third/pacustomer/updatecustomer/" + formDTO.getCustomerId();
Result<String> customerResult = HttpClientManager.getInstance().sendPostByJSON(customerUrl, null);
if (!customerResult.success()) {
throw new RenException(customerResult.getCode(), customerResult.getInternalMsg());
}

11
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/constant/GuideHttpUrlConstant.java

@ -0,0 +1,11 @@
package com.epmet.constant;
/**
* @Author zxc
* @CreateTime 2020/7/30 13:56
*/
public interface GuideHttpUrlConstant {
String CUSTOMER_MSG_URL = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/";
}

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

@ -1,6 +1,8 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -11,7 +13,9 @@ 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;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.GuideHttpUrlConstant;
import com.epmet.constant.StrangerResiGuideConstant;
import com.epmet.dao.StrangerAccessRecordDao;
import com.epmet.dto.PaCustomerDTO;
@ -255,12 +259,7 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
public Result<List<PublicCustomerGridForStrangerResultDTO>> thirdCustomerGridList(PublicCustomerGridListFormDTO formDTO) {
//0.调用epmet-third服务,根据appId查询客户信息
Result<PublicCustomerResultDTO> result = epmetThirdFeignClient.getCustomerMsg(formDTO.getAppId());
if(!result.success()){
throw new RenException(result.getCode());
}
PublicCustomerResultDTO resultDTO = result.getData();
PaCustomerDTO customer = resultDTO.getCustomer();
PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId());
ThirdCustomerGridListFormDTO third = new ThirdCustomerGridListFormDTO();
third.setCustomerId(customer.getId());
@ -306,4 +305,25 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
}
/**
* @Description 获取客户信息
* @param appId
* @author zxc
*/
public PaCustomerDTO getCustomerInfo(String appId){
JSONObject jsonObject = new JSONObject();
String data = HttpClientManager.getInstance().sendPostByJSON(GuideHttpUrlConstant.CUSTOMER_MSG_URL + appId, JSON.toJSONString(jsonObject)).getData();
JSONObject toResult = JSON.parseObject(data);
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class);
if (!mapToResult.success()) {
logger.error(String.format("根据appId查询客户Id失败,对应appId->" + appId));
throw new RenException(mapToResult.getMsg());
}
Object PublicCustomerResultDTO = mapToResult.getData();
JSONObject json = JSON.parseObject(PublicCustomerResultDTO.toString());
PublicCustomerResultDTO publicCustomerResultDTO = ConvertUtils.mapToEntity(json, PublicCustomerResultDTO.class);
PaCustomerDTO customer = publicCustomerResultDTO.getCustomer();
return customer;
}
}

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

@ -1,6 +1,8 @@
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.CustomerStaffDTO;
import com.epmet.dto.GovStaffRoleDTO;
@ -11,10 +13,7 @@ import com.epmet.dto.result.*;
import com.epmet.feign.fallback.EpmetUserOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -229,4 +228,15 @@ public interface EpmetUserOpenFeignClient {
**/
@GetMapping(value = "epmetuser/customerstaff/getCustsomerStaffByIdAndPhone")
Result<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO);
/**
* 获取用户基础信息
*
* @param tokenDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.ResiUserBaseInfoResultDTO>
* @Author zhangyong
* @Date 14:10 2020-07-30
**/
@PostMapping("/epmetuser/userbaseinfo/selectuserbaseinfo")
Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(@RequestBody TokenDto tokenDTO);
}

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

@ -1,6 +1,7 @@
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.CustomerStaffDTO;
@ -167,4 +168,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByIdAndPhone", formDTO);
}
@Override
public Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(TokenDto tokenDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectUserBaseInfo", tokenDTO);
}
}

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

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

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

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.92</version>
<version>0.3.93</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-user</artifactId>

4
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java

@ -158,8 +158,8 @@ public class UserBaseInfoController {
* @Author zhangyong
* @Date 15:20 2020-07-28
**/
@PostMapping("selecuserbaseinfo")
public Result<ResiUserBaseInfoResultDTO> selecUserBaseInfo(@LoginUser TokenDto tokenDTO){
@PostMapping("selectuserbaseinfo")
public Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(@LoginUser TokenDto tokenDTO){
return userBaseInfoService.selecUserBaseInfoByUserId(tokenDTO.getUserId());
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -150,8 +150,9 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
/**
* 居民注册信息提交
*
* @param userResiInfoDTO
* @Author sun
* @Author sunUserRoleServiceImpl
*/
@Override
public Result submit(UserResiInfoDTO userResiInfoDTO) {
@ -253,6 +254,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
UserRoleDTO userRole = new UserRoleDTO();
userRole.setUserId(userResiInfoDTO.getUserId());
userRole.setRoleKey(UserConstant.ROLE_RESI);
userRole.setApp(userResiInfoDTO.getApp());
userRoleService.saveUserRole(userRole);
}

Loading…
Cancel
Save