Browse Source

Merge remote-tracking branch 'origin/dev_thirdplatform' into dev

dev_shibei_match
sunyuchao 5 years ago
parent
commit
9f96fd578c
  1. 6
      epmet-auth/pom.xml
  2. 30
      epmet-auth/src/main/java/com/epmet/constant/PublicUserLoginConstant.java
  3. 50
      epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java
  4. 38
      epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java
  5. 33
      epmet-auth/src/main/java/com/epmet/dto/form/PublicSendSmsCodeFormDTO.java
  6. 25
      epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
  7. 32
      epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java
  8. 193
      epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java
  9. 10
      epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java
  10. 65
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  11. 6
      epmet-module/epmet-third/epmet-third-client/pom.xml
  12. 96
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java
  13. 121
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java
  14. 91
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeMediaDTO.java
  15. 96
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerCodeOperationHistoryDTO.java
  16. 7
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java
  17. 4
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java
  18. 4
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java
  19. 14
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java
  20. 46
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java
  21. 56
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java
  22. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/MyInfoFormDTO.java
  23. 54
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RegisterFormDTO.java
  24. 34
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveUserVisitedFormDTO.java
  25. 25
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AgencyLevelListResultDTO.java
  26. 27
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java
  27. 25
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java
  28. 53
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java
  29. 21
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SaveUserResultDTO.java
  30. 36
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java
  31. 22
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java
  32. 6
      epmet-module/epmet-third/epmet-third-server/pom.xml
  33. 63
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java
  34. 84
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeAuditResultController.java
  35. 30
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java
  36. 84
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeCustomerController.java
  37. 84
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeMediaController.java
  38. 84
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerCodeOperationHistoryController.java
  39. 78
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  40. 37
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserController.java
  41. 15
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java
  42. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java
  43. 33
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.java
  44. 33
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.java
  45. 33
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeMediaDao.java
  46. 33
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerCodeOperationHistoryDao.java
  47. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java
  48. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerAgencyDao.java
  49. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java
  50. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserDao.java
  51. 19
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java
  52. 66
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditResultEntity.java
  53. 91
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java
  54. 61
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeMediaEntity.java
  55. 66
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerCodeOperationHistoryEntity.java
  56. 7
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java
  57. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java
  58. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java
  59. 6
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java
  60. 47
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeAuditResultRedis.java
  61. 47
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeCustomerRedis.java
  62. 47
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeMediaRedis.java
  63. 47
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerCodeOperationHistoryRedis.java
  64. 95
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeAuditResultService.java
  65. 95
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java
  66. 95
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeMediaService.java
  67. 12
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java
  68. 95
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerCodeOperationHistoryService.java
  69. 39
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  70. 19
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserService.java
  71. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java
  72. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserWechatService.java
  73. 104
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java
  74. 104
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java
  75. 104
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeMediaServiceImpl.java
  76. 17
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
  77. 104
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerCodeOperationHistoryServiceImpl.java
  78. 234
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  79. 89
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java
  80. 39
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserVisitedServiceImpl.java
  81. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserWechatServiceImpl.java
  82. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java
  83. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatus.java
  84. 18
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatusReq.java
  85. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java
  86. 145
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java
  87. 36
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java
  88. 52
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaCategoryResult.java
  89. 28
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetCategoryResult.java
  90. 28
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetPageResult.java
  91. 76
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java
  92. 179
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java
  93. 22
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml
  94. 27
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml
  95. 21
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeMediaDao.xml
  96. 22
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerCodeOperationHistoryDao.xml
  97. 15
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml
  98. 18
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerAgencyDao.xml
  99. 12
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml
  100. 12
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaUserDao.xml

6
epmet-auth/pom.xml

@ -116,6 +116,12 @@
<version>3.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

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

@ -0,0 +1,30 @@
package com.epmet.constant;
/**
* @author sun
* @dscription
*/
public interface PublicUserLoginConstant {
/**
* 初始化用户信息失败
*/
String SAVE_USER_EXCEPTION = "初始化用户信息失败";
/**
* 是否登陆true false
*/
String PARAMETER_EXCEPTION = "是否登陆值错误";
/**
* 登陆验证
*/
String LOGON_EXCEPTION = "该手机号未注册";
/**
* 注册验证
*/
String ZHU_CE_EXCEPTION = "该手机号已注册";
/**
* 用户登陆 新增访问记录
*/
String SAVE_VISITED_EXCEPTION = "用户登陆,新增访问记录失败";
}

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

@ -1,8 +1,15 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.PublicUserLoginConstant;
import com.epmet.dto.form.LoginByPhoneFormDTO;
import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.form.PublicSendSmsCodeFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.PublicUserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -10,8 +17,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 描述一下
*
@ -28,15 +33,42 @@ public class PublicUserLoginController {
/**
* @return com.epmet.commons.tools.utils.Result
* @param formDTO
* @author yinzuomei
* @description 测试是否能正常解析wxcode
* @Date 2020/7/9 17:00
* @author sun
* @description 解析wxcode获取用户信息并生成token
**/
@PostMapping(value = "/testwxcode")
public Result loginByWxCode(@RequestBody PaWxCodeFormDTO formDTO) {
@PostMapping(value = "/wxcodetotoken")
public Result<UserTokenResultDTO> wxCodeToToken(@RequestBody PaWxCodeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, PaWxCodeFormDTO.AddUserInternalGroup.class);
Map map = publicUserLoginService.loginByWxCode(formDTO);
return new Result().ok(map);
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.wxCodeToToken(formDTO));
}
/**
* @param formDTO 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 公众号登录-发送验证码
**/
@PostMapping(value = "/sendsmscode")
public Result sendSmsCode(@RequestBody PublicSendSmsCodeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,PublicSendSmsCodeFormDTO.AddUserShowGroup.class);
if(formDTO.getIsLogon()!=true&&formDTO.getIsLogon()!=false){
throw new RenException(PublicUserLoginConstant.PARAMETER_EXCEPTION);
}
publicUserLoginService.sendSmsCode(formDTO);
return new Result();
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 公众号-手机验证码登陆
**/
@PostMapping(value = "/loginbyphone")
public Result<UserTokenResultDTO> loginByPhone(@LoginUser TokenDto tokenDTO, @RequestBody LoginByPhoneFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, LoginByPhoneFormDTO.AddUserShowGroup.class, LoginByPhoneFormDTO.LoginByPhone.class);
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO));
}
}

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

@ -0,0 +1,38 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 手机验证码登陆接口入参
* @Author sun
*/
@Data
public class LoginByPhoneFormDTO implements Serializable {
private static final long serialVersionUID = 4193133227120225342L;
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
public interface LoginByPhone extends CustomerClientShowGroup{}
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class})
private String phone;
/**
* 验证码
*/
@NotBlank(message="验证码不能为空", groups = {LoginByPhone.class})
private String smsCode;
}

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

@ -0,0 +1,33 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 公众号手机号+验证码登录接口入参
* @Author sun
*/
@Data
public class PublicSendSmsCodeFormDTO implements Serializable {
private static final long serialVersionUID = -1852541457359282018L;
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class})
private String phone;
/**
* 是否登陆登陆true 注册false
*/
private Boolean isLogon;
}

25
epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java

@ -11,6 +11,7 @@ package com.epmet.redis;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dto.form.PublicSendSmsCodeFormDTO;
import com.epmet.dto.form.SendSmsCodeFormDTO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -82,4 +83,28 @@ public class CaptchaRedis {
String smsCode = (String) redisUtils.get(smsCodeKey);
return smsCode;
}
/**
* @param sendSmsCodeFormDTO appclientphone
* @param smsCode 验证码
* @return void
* @Author sun
* @Description 公众号-短信验证码存入redis
**/
public void savePublicSmsCode(PublicSendSmsCodeFormDTO sendSmsCodeFormDTO, String smsCode) {
String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, sendSmsCodeFormDTO.getPhone());
logger.info(String.format("短信验证码key=%s", smsCodeKey));
redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE);
}
/**
* @param phone
* @return java.lang.String
* @Author sun
* @Description 公众号-获取登录时发送的验证码
**/
public String getPublicSmsCode(String phone) {
String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, phone);
String smsCode = (String) redisUtils.get(smsCodeKey);
return smsCode;
}
}

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

@ -1,8 +1,10 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.LoginByPhoneFormDTO;
import com.epmet.dto.form.PaWxCodeFormDTO;
import java.util.Map;
import com.epmet.dto.form.PublicSendSmsCodeFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
/**
* 描述一下
@ -11,5 +13,29 @@ import java.util.Map;
* @date 2020/7/8 18:31
*/
public interface PublicUserLoginService {
Map loginByWxCode(PaWxCodeFormDTO formDTO);
/**
* @return
* @param formDTO
* @author sun
* @description 解析wxcode获取用户信息并生成token
**/
UserTokenResultDTO wxCodeToToken(PaWxCodeFormDTO formDTO);
/**
* @param formDTO 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 公众号登录-发送验证码
**/
void sendSmsCode(PublicSendSmsCodeFormDTO formDTO);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 公众号-手机验证码登陆
**/
UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO);
}

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

@ -1,7 +1,27 @@
package com.epmet.service.impl;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
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.validator.PhoneValidatorUtils;
import com.epmet.constant.PublicUserLoginConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.dto.result.SendVerificationCodeResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetThirdFeignClient;
import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.CaptchaRedis;
import com.epmet.service.PublicUserLoginService;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
@ -25,16 +45,42 @@ import java.util.Map;
@Service
public class PublicUserLoginServiceImpl implements PublicUserLoginService {
private static final Logger logger = LoggerFactory.getLogger(PublicUserLoginServiceImpl.class);
private static final String SEND_SMS_CODE_ERROR = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]";
@Autowired
private WxMpService wxMpService;
@Autowired
private EpmetThirdFeignClient epmetThirdFeignClient;
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private JwtTokenProperties jwtTokenProperties;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private CaptchaRedis captchaRedis;
@Override
public Map loginByWxCode(PaWxCodeFormDTO formDTO) {
WxMpUser wxMpUser=this.getWxMpUser(formDTO.getWxCode());
Map map =new HashMap();
map.put("微信用户信息",wxMpUser);
return map;
public UserTokenResultDTO wxCodeToToken(PaWxCodeFormDTO formDTO) {
//1.通过微信code获取用户基本信息
WxMpUser wxMpUser = this.getWxMpUser(formDTO.getWxCode());
//2.将获取的用户基本信息初始化到数据库
Result<SaveUserResultDTO> result = epmetThirdFeignClient.saveUser(wxMpUser);
if (!result.success()) {
throw new RenException(PublicUserLoginConstant.SAVE_USER_EXCEPTION);
}
SaveUserResultDTO resultDTO = result.getData();
//3.获取用户token
String token = this.generateGovWxmpToken(resultDTO.getUserId());
//4.保存到redis
this.saveLatestGovTokenDto(resultDTO, wxMpUser, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
private WxMpUser getWxMpUser(String wxCode) {
@ -43,9 +89,9 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(wxCode);
wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, null);
} catch (WxErrorException e) {
logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败",e.getMessage());
logger.error("->[getWxMpUser]::error[{}]", "解析微信用户信息失败", e.getMessage());
e.printStackTrace();
throw new RenException("解析微信用户信息失败"+e.getMessage());
throw new RenException("解析微信用户信息失败" + e.getMessage());
}
if (null == wxMpUser ) {
logger.error("wxMpUser is null");
@ -57,4 +103,135 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
}
return wxMpUser;
}
/**
* @Description 生成token
**/
private String generateGovWxmpToken(String userId) {
Map<String, Object> map = new HashMap<>();
map.put("app", LoginConstant.APP_PUBLIC);
map.put("client", LoginConstant.CLIENT_MP);
map.put("userId", userId);
String token = jwtTokenUtils.createToken(map);
logger.info("app:" + LoginConstant.APP_PUBLIC + ";client:" + LoginConstant.CLIENT_MP + ";userId:" + userId + ";生成token[" + token + "]");
return token;
}
//保存tokenDto到redis
private void saveLatestGovTokenDto(SaveUserResultDTO resultDTO, WxMpUser wxMpUser, String token) {
TokenDto tokenDTO = new TokenDto();
int expire = jwtTokenProperties.getExpire();
tokenDTO.setOpenId(wxMpUser.getOpenId());
tokenDTO.setUnionId(wxMpUser.getUnionId());
tokenDTO.setToken(token);
//首次初始化时还没有客户
tokenDTO.setCustomerId("");
tokenDTO.setUserId(resultDTO.getUserId());
tokenDTO.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
tokenDTO.setUpdateTime(System.currentTimeMillis());
cpUserDetailRedis.set(tokenDTO, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
}
/**
* @param formDTO 手机号
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 公众号登录-发送验证码
**/
@Override
public void sendSmsCode(PublicSendSmsCodeFormDTO formDTO) {
//1、校验手机号是否符合规范
if (!PhoneValidatorUtils.isMobile(formDTO.getPhone())) {
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());
}
CustomerUserResultDTO ResultDTO = Result.getData();
//登陆
if (formDTO.getIsLogon() && null == ResultDTO.getPaUserResult()) {
throw new RenException(PublicUserLoginConstant.LOGON_EXCEPTION);
}
//注册
if (!formDTO.getIsLogon() && null != ResultDTO.getPaUserResult()) {
throw new RenException(PublicUserLoginConstant.ZHU_CE_EXCEPTION);
}
//3、发送短信验证码
SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO();
sendVerificationCodeFormDTO.setMobile(formDTO.getPhone());
//登陆或注册对应的短息模板
sendVerificationCodeFormDTO.setAliyunTemplateCode(formDTO.getIsLogon() ? SmsTemplateConstant.LGOIN_CONFIRM : SmsTemplateConstant.USER_REGISTER);
Result<SendVerificationCodeResultDTO> smsCodeResult = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO);
if (!smsCodeResult.success()) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getPhone(), smsCodeResult.getCode(), smsCodeResult.getMsg()));
throw new RenException(smsCodeResult.getCode());
}
//4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis)
captchaRedis.savePublicSmsCode(formDTO, smsCodeResult.getData().getCode());
logger.info(String.format("发送短信验证码成功,手机号[%s]", formDTO.getPhone()));
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 公众号-手机验证码登陆
**/
@Override
public UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO) {
//1.根据手机号查询到用户、客户信息
Result<CustomerUserResultDTO> result = epmetThirdFeignClient.checkPaUser(formDTO.getPhone());
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();
//2.用户不存在时不允许登陆
PaUserDTO userDTO = resultDTO.getPaUserResult();
if (null == userDTO || StringUtils.isBlank(userDTO.getId())) {
throw new RenException(PublicUserLoginConstant.LOGON_EXCEPTION);
}
//3.校验验证码是否正确
String rightSmsCode = captchaRedis.getPublicSmsCode(formDTO.getPhone());
if (!formDTO.getSmsCode().equals(rightSmsCode)) {
logger.error(String.format("验证码错误code[%s],msg[%s]", EpmetErrorCode.MOBILE_CODE_ERROR.getCode(), EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//获取缓存中的token
TokenDto redisTokenDTO = cpUserDetailRedis.get(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, userDTO.getId(), TokenDto.class);
if (redisTokenDTO == null) {
return null;
}
//4.判断是否存在客户信息,是否需要生成新的token
PaCustomerDTO customerDTO = resultDTO.getPaCustomerResult();
if (null != customerDTO && !StringUtils.isBlank(customerDTO.getId())) {
redisTokenDTO.setCustomerId(customerDTO.getId());
int expire = jwtTokenProperties.getExpire();
cpUserDetailRedis.set(redisTokenDTO, expire);
}
//5.登陆成功,访问记录表新增访问记录(访问记录新增失败不应影响用户登陆)
SaveUserVisitedFormDTO visited = new SaveUserVisitedFormDTO();
visited.setUserId(userDTO.getId());
visited.setLogonUserId(tokenDTO.getUserId());
visited.setPhone(formDTO.getPhone());
Result visitedResult = epmetThirdFeignClient.saveUserVisited(visited);
if(!visitedResult.success()){
logger.error(PublicUserLoginConstant.SAVE_VISITED_EXCEPTION);
}
//6.返回token
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(redisTokenDTO.getToken());
return userTokenResultDTO;
}
}

10
epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java

@ -21,6 +21,11 @@ public interface LoginConstant {
*/
String APP_OPER = "oper";
/**
* 公众号
*/
String APP_PUBLIC = "public";
/**
* web
*/
@ -30,4 +35,9 @@ public interface LoginConstant {
* 微信小程序
*/
String CLIENT_WXMP = "wxmp";
/**
* E事通服务号
*/
String CLIENT_MP = "mp";
}

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

@ -8,6 +8,7 @@ import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
@ -27,7 +28,10 @@ import org.springframework.util.CollectionUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
@ -204,6 +208,67 @@ public class HttpClientManager {
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
/**
* desc: 发送get请求
* param:url, params
* return: CallResult<String>
* date: 2019/2/21 9:16
*
* @author: jianjun liu
*/
public Result<Byte[]> sendGetFile(String url, Map<String, Object> params) {
try {
URIBuilder builder = new URIBuilder(url);
if (!CollectionUtils.isEmpty(params)) {
Set<String> set = params.keySet();
for (String key : set) {
builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key)));
}
}
HttpGet httpGet = new HttpGet(builder.build());
httpGet.setConfig(requestConfig);
return executeToByte(httpGet);
} catch (Exception e) {
log.error("sendGet exception", e);
return new Result<Byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
private Result<Byte[]> executeToByte(HttpRequestBase httpMethod) {
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpMethod);
log.debug("http send response:{}", JSON.toJSONString(response));
if (response != null && response.getStatusLine() != null) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
InputStream in = response.getEntity().getContent();
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int n = 0;
while (-1 != (n = in.read(buffer))) {
output.write(buffer, 0, n);
}
return new Result<Byte[]>().ok(ArrayUtils.toObject(output.toByteArray()));
} else {
log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
}
}
} catch (Exception e) {
log.error("execute exception", e);
return new Result<Byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} finally {
httpMethod.releaseConnection();
try {
if (response != null) {
response.close();
}
} catch (IOException e) {
}
}
return new Result<Byte[]>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
public static void main(String[] args) {
String url = "http://localhost:8107/epmetscan/api/textSyncScan";
TextTaskDTO p = new TextTaskDTO();

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

@ -20,6 +20,12 @@
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>3.6.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

96
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeAuditResultDTO.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 代码审核j结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
public class CodeAuditResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 代码ID
*/
private String codeId;
/**
* 审核ID
*/
private String auditId;
/**
* 审核结果 审核中:auditing审核成功audit_success审核被拒绝audit_failed已撤回:withdrawn审核延后:delay
*/
private String result;
/**
* 原因
*/
private String reason;
/**
* 乐观锁
*/
private Integer revision;
/**
* 是否删除
*/
private String delFlag;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

121
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java

@ -0,0 +1,121 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 客户代码关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
public class CodeCustomerDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 客户名
*/
private String customerName;
/**
* 小程序接口调用令牌ID
*/
private String accessTokenId;
/**
* 模板ID
*/
private String templateId;
/**
* 小程序类型 居民端resi,工作端work
*/
private String type;
/**
* APPID
*/
private String appId;
/**
* 自定义配置
*/
private String extJson;
/**
* 代码版本号
*/
private String userVersion;
/**
* 代码描述
*/
private String userDesc;
/**
* 状态 未审核:unaudited审核中:auditing审核成功audit_success审核被拒绝audit_failed已撤回:withdrawn审核延后:delay发布成功release_success, 发布失败release_failed
*/
private String status;
/**
* 乐观锁
*/
private Integer revision;
/**
* 是否删除
*/
private String delFlag;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

91
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeMediaDTO.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 代码素材
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
public class CodeMediaDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 代码ID
*/
private String codeId;
/**
* 素材ID
*/
private String mediaId;
/**
* 素材名
*/
private String mediaName;
/**
* 素材类型 图片image语音voice视频video和缩略图thumb
*/
private String mediaType;
/**
* 乐观锁
*/
private Integer revision;
/**
* 更新人
*/
private String updatedBy;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 是否删除
*/
private String delFlag;
/**
* 更新时间
*/
private Date updatedTime;
}

96
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerCodeOperationHistoryDTO.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 客户代码操作历史
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
public class CustomerCodeOperationHistoryDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 代码ID
*/
private String codeId;
/**
* 版本
*/
private String version;
/**
* 操作类型 操作 上传upload审核audit撤回undo发布release
*/
private String operation;
/**
* 描述
*/
private String describe;
/**
* 乐观锁
*/
private Integer revision;
/**
* 是否删除
*/
private String delFlag;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

7
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CustomerMpDTO.java

@ -54,15 +54,10 @@ public class CustomerMpDTO implements Serializable {
private Integer appId;
/**
* 是否已经授权
* 是否已经授权 0未授权1已授权
*/
private Integer authorizationFlag;
/**
* 公众账号信息id
*/
private String authorizerInfoId;
/**
* 删除标识0.未删除 1.已删除
*/

4
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserDTO.java

@ -34,9 +34,9 @@ public class PaUserDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 本主键会用作customer_staff里的user_iduser表的id
* user表的id
*/
private Integer id;
private String id;
/**
* 手机号

4
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserVisitedDTO.java

@ -34,9 +34,9 @@ public class PaUserVisitedDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 本主键会用作customer_staff里的user_iduser表的id
* user表的id
*/
private Integer id;
private String id;
/**
* 用户Id pa_user.id

14
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PaUserWechatDTO.java

@ -34,9 +34,9 @@ public class PaUserWechatDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 本主键会用作customer_staff里的user_iduser表的id
* user表的id
*/
private Integer id;
private String id;
/**
* 用户Id user.id
@ -53,11 +53,6 @@ public class PaUserWechatDTO implements Serializable {
*/
private String unionId;
/**
* 手机号
*/
private String phone;
/**
* 1男2女0未知
*/
@ -88,11 +83,6 @@ public class PaUserWechatDTO implements Serializable {
*/
private String city;
/**
* 用户特权信息json 数组如微信沃卡用户为chinaunicom
*/
private String privilege;
/**
* 语言
*/

46
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeUploadFormDTO.java

@ -0,0 +1,46 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/9 14:24
*/
@NoArgsConstructor
@Data
public class CodeUploadFormDTO implements Serializable {
private static final long serialVersionUID = 1295337818281424509L;
/**
* 小程序接口调用令牌ID
*/
private String accessTokenId;
/**
* 小程序类型 居民端resi 工作段work
*/
private String type;
/**
* 客户ID
*/
private String customerId;
/**
* 代码库中的代码模板 ID
*/
private String templateId;
/**
* 第三方自定义的配置
*/
private String extJson;
/**
* 代码版本号
*/
private String userVersion;
/**
* 代码描述
*/
private String userDesc;
}

56
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CreateAgencyFormDTO.java

@ -0,0 +1,56 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author sun
* @Description 公众号-创建组织-接口入参
*/
@Data
public class CreateAgencyFormDTO implements Serializable {
private static final long serialVersionUID = -6547893374373422628L;
public interface AddUserInternalGroup {}
/**
* 根组织名称
*/
@NotBlank(message = "组织名称不能为空")
private String agencyName;
/**
* 级别
*/
@NotBlank(message = "组织级别不能为空")
private String level;
/**
* 地区编码
*/
@NotBlank(message = "地区编码不能为空")
private String areaCode;
/**
* 中国字
*/
private String province = "";
/**
* 中国字
*/
private String city = "";
/**
* 中国字
*/
private String district = "";
/**
* 党支部数量
*/
private Integer partyBranchNum = 0;
}

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

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author sun
* @Description 公众号-查询我的信息-接口入参
*/
@Data
public class MyInfoFormDTO implements Serializable {
private static final long serialVersionUID = -6547893374373422628L;
public interface AddUserInternalGroup {
}
/**
* 客户Id
*/
@NotBlank(message = "客户Id不能为空", groups = {MyInfoFormDTO.AddUserInternalGroup.class})
private String customerId;
}

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

@ -0,0 +1,54 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author sun
* @Description 公众号-手机号注册-接口入参
*/
@Data
public class RegisterFormDTO implements Serializable {
private static final long serialVersionUID = -6547893374373422628L;
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class})
private String phone;
/**
* 手机短信验证码
*/
@NotBlank(message = "验证码不能为空", groups = {AddUserShowGroup.class})
private String smsCode;
/**
* 姓氏
*/
@NotBlank(message = "姓氏不能为空", groups = {AddUserShowGroup.class})
private String surName;
/**
* 性别 1男2女0未知
*/
@NotNull(message = "用户性别不能为空", groups = {AddUserShowGroup.class})
private Integer gender;
/**
* token中userId
*/
private String userId;
}

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

@ -0,0 +1,34 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author sun
* @Description 公众号-用户登陆新增访问记录-接口入参
*/
@Data
public class SaveUserVisitedFormDTO implements Serializable {
private static final long serialVersionUID = -6547893374373422628L;
public interface AddUserInternalGroup {}
/**
* 登陆手机号对应的userId
*/
private String userId;
/**
* 登陆人userId
*/
private String logonUserId;
/**
* 登陆手机号
*/
private String phone;
}

25
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/AgencyLevelListResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* @Description 公众号-查询组织级别-接口返参
*/
@Data
public class AgencyLevelListResultDTO implements Serializable {
private static final long serialVersionUID = 3253989119352850315L;
/**
* 机关级别社区级community 街道:street, 区县级: district, 市级: city 省级:province
*/
private String levelKey;
/**
* 级别对应的名称
*/
private String levelName;
}

27
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CreateAgencyResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Author sun
* @Description 公众号-创建组织-接口返参
*/
@Data
public class CreateAgencyResultDTO implements Serializable {
private static final long serialVersionUID = 3253989119352850315L;
/**
* 新增客户Id
*/
private String customerId;
/**
* 包含customerId的token
*/
private String token;
}

25
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerUserResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.result;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PaUserDTO;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 根据手机号查询用户信息客户信息-接口返参
* @Author sun
*/
@Data
public class CustomerUserResultDTO implements Serializable {
private static final long serialVersionUID = 5214475907074876716L;
/**
* 用户信息
*/
private PaUserDTO paUserResult;
/**
* 用户对应的客户信息
*/
private PaCustomerDTO paCustomerResult;
}

53
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/MyInfoResultDTO.java

@ -0,0 +1,53 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* @Description 公众号-查询我的信息-接口返参
*/
@Data
public class MyInfoResultDTO implements Serializable {
private static final long serialVersionUID = 3253989119352850315L;
/**
* 客户Id
*/
private String customerId = "";
/**
* 组织名称
*/
private String agencyName = "";
/**
* 组织级别
*/
private String level = "";
/**
*
*/
private String province = "";
/**
*
*/
private String city = "";
/**
*
*/
private String district = "";
/**
* 党支部数量
*/
private Integer partyBranchNum;
/**
* 居民端授权状态(0未授权1已授权)
*/
private Integer resiAuthorization;
/**
* 政府端授权状态(0未授权1已授权)
*/
private Integer workAuthorization;
}

21
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SaveUserResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* @Description 授权用户信息时新增或更新用户信息-接口返参
*/
@Data
public class SaveUserResultDTO implements Serializable {
private static final long serialVersionUID = 3253989119352850315L;
/**
* 新增或已有用户的Id
*/
private String userId;
}

36
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java

@ -1,8 +1,17 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.feign.fallback.EpmetThirdFeignClientFallback;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
@ -13,4 +22,31 @@ import org.springframework.cloud.openfeign.FeignClient;
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdFeignClientFallback.class)
public interface EpmetThirdFeignClient {
/**
* @param wxMpUser
* @return
* @Author sun
* @Description 根据openId新增或更新用户信息
**/
@PostMapping(value = "third/pauser/saveuser", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result<SaveUserResultDTO> saveUser(@RequestBody WxMpUser wxMpUser);
/**
* @param phone
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
**/
@PostMapping(value = "third/pauser/checkpauser/{phone}")
Result<CustomerUserResultDTO> checkPaUser(@PathVariable("phone") String phone);
/**
* @param visited
* @return
* @Author sun
* @Description 用户登陆新增访问记录数据
**/
@PostMapping(value = "third/pauservisited/saveuservisited")
Result saveUserVisited(@RequestBody SaveUserVisitedFormDTO visited);
}

22
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java

@ -1,6 +1,13 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.feign.EpmetThirdFeignClient;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.stereotype.Component;
/**
@ -9,4 +16,19 @@ import org.springframework.stereotype.Component;
*/
@Component
public class EpmetThirdFeignClientFallback implements EpmetThirdFeignClient {
@Override
public Result<SaveUserResultDTO> saveUser(WxMpUser wxMpUser) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveUser", wxMpUser);
}
@Override
public Result<CustomerUserResultDTO> checkPaUser(String phone) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "checkPaUser", phone);
}
@Override
public Result saveUserVisited(SaveUserVisitedFormDTO visited) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveUserVisited", visited);
}
}

6
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -123,6 +123,12 @@
<version>3.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-common-clienttoken</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

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

@ -0,0 +1,63 @@
package com.epmet.constant;
/**
* @Description 公众号-常量
* @author sun
*/
public interface PaConstant {
/**
* 手机号注册
*/
String PHONE_EXCEPTION = "手机号已存在,不允许再次注册";
/**
* 更新用户信息失败
*/
String UPDATE_USER_EXCEPTION = "更新用户信息失败";
/**
* 根据userId查询pa_user_wechat表失败
*/
String SELECT_WECHAT_EXCEPTION = "获取用户微信信息失败";
/**
* 保存用户访问记录数据失败
*/
String SAVE_VISITED_EXCEPTION = "保存用户访问记录数据失败";
/**
* 组织级别对应的keyname
*/
String PROVINCE_KEY = "province";
String PROVINCE_NAME = "省级";
String CITY_KEY = "city";
String CITY_NAME = "区县级";
String STREET_KEY = "street";
String STREET_NAME = "乡(镇、街道)级";
String COMMUNITY_KEY = "community";
String COMMUNITY_NAME = "社区级";
/**
* 客户小程序关系表小程序所属端
*/
String RESI_CLIENT = "resi";
String WORK_CLIENT = "work";
/**
* 查询客户组织信息失败
*/
String SELECT_AGENCY_EXCEPTION = "获取客户组织信息失败";
/**
* 查询客户小程序授权信息失败
*/
String CUSTOMER_MP_EXCEPTION = "获取客户小程序授权信息失败";
/**
* 客户小程序所属端key值
*/
String CLIENT_RESI = "resi";
String CLIENT_WORK = "work";
/**
* 获取缓存中token信息失败
*/
String TOKEN_EXCEPTION = "token已过期";
}

84
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeAuditResultController.java

@ -0,0 +1,84 @@
/**
* 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.controller;
import com.epmet.commons.tools.page.PageData;
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.dto.CodeAuditResultDTO;
import com.epmet.service.CodeAuditResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 代码审核j结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@RestController
@RequestMapping("codeauditresult")
public class CodeAuditResultController {
@Autowired
private CodeAuditResultService codeAuditResultService;
@GetMapping("page")
public Result<PageData<CodeAuditResultDTO>> page(@RequestParam Map<String, Object> params){
PageData<CodeAuditResultDTO> page = codeAuditResultService.page(params);
return new Result<PageData<CodeAuditResultDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<CodeAuditResultDTO> get(@PathVariable("id") String id){
CodeAuditResultDTO data = codeAuditResultService.get(id);
return new Result<CodeAuditResultDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody CodeAuditResultDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
codeAuditResultService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody CodeAuditResultDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
codeAuditResultService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
codeAuditResultService.delete(ids);
return new Result();
}
}

30
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java

@ -0,0 +1,30 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CodeUploadFormDTO;
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;
/**
* @author zhaoqifeng
* @dscription 代码管理
* @date 2020/7/9 11:02
*/
@RestController
@RequestMapping("code")
public class CodeController {
/**
* 代码上传
* @author zhaoqifeng
* @date 2020/7/9 14:23
* @param
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("upload")
public Result upload(@RequestBody CodeUploadFormDTO formDTO) {
return new Result<>();
}
}

84
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeCustomerController.java

@ -0,0 +1,84 @@
/**
* 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.controller;
import com.epmet.commons.tools.page.PageData;
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.dto.CodeCustomerDTO;
import com.epmet.service.CodeCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 客户代码关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@RestController
@RequestMapping("codecustomer")
public class CodeCustomerController {
@Autowired
private CodeCustomerService codeCustomerService;
@GetMapping("page")
public Result<PageData<CodeCustomerDTO>> page(@RequestParam Map<String, Object> params){
PageData<CodeCustomerDTO> page = codeCustomerService.page(params);
return new Result<PageData<CodeCustomerDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<CodeCustomerDTO> get(@PathVariable("id") String id){
CodeCustomerDTO data = codeCustomerService.get(id);
return new Result<CodeCustomerDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody CodeCustomerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
codeCustomerService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody CodeCustomerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
codeCustomerService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
codeCustomerService.delete(ids);
return new Result();
}
}

84
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeMediaController.java

@ -0,0 +1,84 @@
/**
* 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.controller;
import com.epmet.commons.tools.page.PageData;
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.dto.CodeMediaDTO;
import com.epmet.service.CodeMediaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 代码素材
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@RestController
@RequestMapping("codemedia")
public class CodeMediaController {
@Autowired
private CodeMediaService codeMediaService;
@GetMapping("page")
public Result<PageData<CodeMediaDTO>> page(@RequestParam Map<String, Object> params){
PageData<CodeMediaDTO> page = codeMediaService.page(params);
return new Result<PageData<CodeMediaDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<CodeMediaDTO> get(@PathVariable("id") String id){
CodeMediaDTO data = codeMediaService.get(id);
return new Result<CodeMediaDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody CodeMediaDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
codeMediaService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody CodeMediaDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
codeMediaService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
codeMediaService.delete(ids);
return new Result();
}
}

84
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CustomerCodeOperationHistoryController.java

@ -0,0 +1,84 @@
/**
* 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.controller;
import com.epmet.commons.tools.page.PageData;
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.dto.CustomerCodeOperationHistoryDTO;
import com.epmet.service.CustomerCodeOperationHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 客户代码操作历史
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@RestController
@RequestMapping("customercodeoperationhistory")
public class CustomerCodeOperationHistoryController {
@Autowired
private CustomerCodeOperationHistoryService customerCodeOperationHistoryService;
@GetMapping("page")
public Result<PageData<CustomerCodeOperationHistoryDTO>> page(@RequestParam Map<String, Object> params){
PageData<CustomerCodeOperationHistoryDTO> page = customerCodeOperationHistoryService.page(params);
return new Result<PageData<CustomerCodeOperationHistoryDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<CustomerCodeOperationHistoryDTO> get(@PathVariable("id") String id){
CustomerCodeOperationHistoryDTO data = customerCodeOperationHistoryService.get(id);
return new Result<CustomerCodeOperationHistoryDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody CustomerCodeOperationHistoryDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
customerCodeOperationHistoryService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody CustomerCodeOperationHistoryDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
customerCodeOperationHistoryService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
customerCodeOperationHistoryService.delete(ids);
return new Result();
}
}

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

@ -1,8 +1,25 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.form.CreateAgencyFormDTO;
import com.epmet.dto.form.MyInfoFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.result.AgencyLevelListResultDTO;
import com.epmet.dto.result.CreateAgencyResultDTO;
import com.epmet.dto.result.MyInfoResultDTO;
import com.epmet.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 公众号用户的注册客户创建跟组织创建 查询我的详情等等...api写在这
*
@ -12,4 +29,65 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("pacustomer")
public class PaCustomerController {
@Autowired
private PaUserService paUserService;
@Autowired
private PaCustomerService paCustomerService;
@Autowired
private PaCustomerAgencyService paCustomerAgencyService;
@Autowired
private PaCustomerUserAgencyService paCustomerUserAgencyService;
@Autowired
private CustomerMpService customerMpService;
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
@PostMapping("register")
public Result register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class);
formDTO.setUserId(tokenDTO.getUserId());
paCustomerService.register(formDTO);
return new Result();
}
/**
* @return
* @Author sun
* @Description 公众号-查询组织级别
**/
@PostMapping("agencylevellist")
public Result<List<AgencyLevelListResultDTO>> agencyLevelList() {
return new Result<List<AgencyLevelListResultDTO>>().ok(paCustomerService.agencyLevelList());
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-创建组织
**/
@PostMapping("createagency")
public Result<CreateAgencyResultDTO> createAgency(@LoginUser TokenDto tokenDTO, @RequestBody CreateAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, DefaultGroup.class);
return new Result<CreateAgencyResultDTO>().ok(paCustomerService.createAgency(tokenDTO, formDTO));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-查询我的信息
**/
@PostMapping("myinfo")
public Result<MyInfoResultDTO> myInfo(@LoginUser TokenDto tokenDTO, @RequestBody MyInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MyInfoFormDTO.AddUserInternalGroup.class);
return new Result<MyInfoResultDTO>().ok(paCustomerService.myInfo(formDTO));
}
}

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

@ -26,8 +26,11 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.PaUserDTO;
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.*;
@ -45,24 +48,24 @@ import java.util.Map;
@RestController
@RequestMapping("pauser")
public class PaUserController {
@Autowired
private PaUserService paUserService;
@GetMapping("page")
public Result<PageData<PaUserDTO>> page(@RequestParam Map<String, Object> params){
public Result<PageData<PaUserDTO>> page(@RequestParam Map<String, Object> params) {
PageData<PaUserDTO> page = paUserService.page(params);
return new Result<PageData<PaUserDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<PaUserDTO> get(@PathVariable("id") String id){
public Result<PaUserDTO> get(@PathVariable("id") String id) {
PaUserDTO data = paUserService.get(id);
return new Result<PaUserDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody PaUserDTO dto){
public Result save(@RequestBody PaUserDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
paUserService.save(dto);
@ -70,7 +73,7 @@ public class PaUserController {
}
@PutMapping
public Result update(@RequestBody PaUserDTO dto){
public Result update(@RequestBody PaUserDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
paUserService.update(dto);
@ -78,7 +81,7 @@ public class PaUserController {
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
public Result delete(@RequestBody String[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
paUserService.delete(ids);
@ -91,4 +94,26 @@ public class PaUserController {
ExcelUtils.exportExcelToTarget(response, null, list, PaUserExcel.class);
}
/**
* @param wxMpUser
* @return
* @Author sun
* @Description 根据openId新增或更新用户信息
**/
@PostMapping(value = "/saveuser")
public Result<SaveUserResultDTO> saveUser(@RequestBody WxMpUser wxMpUser) {
return new Result<SaveUserResultDTO>().ok(paUserService.saveUser(wxMpUser));
}
/**
* @param phone
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
**/
@PostMapping(value = "/checkpauser/{phone}")
public Result<CustomerUserResultDTO> checkPaUser(@PathVariable("phone") String phone) {
return new Result<CustomerUserResultDTO>().ok(paUserService.checkPaUser(phone));
}
}

15
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaUserVisitedController.java

@ -23,9 +23,10 @@ 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.PaUserVisitedDTO;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.excel.PaUserVisitedExcel;
import com.epmet.service.PaUserVisitedService;
import org.springframework.beans.factory.annotation.Autowired;
@ -91,4 +92,16 @@ public class PaUserVisitedController {
ExcelUtils.exportExcelToTarget(response, null, list, PaUserVisitedExcel.class);
}
/**
* @param visited
* @return
* @Author sun
* @Description 用户登陆新增访问记录数据
**/
@PostMapping(value = "/saveuservisited")
public Result saveUserVisited(@RequestBody SaveUserVisitedFormDTO visited) {
paUserVisitedService.saveUserVisited(visited);
return new Result();
}
}

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java

@ -3,11 +3,7 @@ package com.epmet.controller;
import com.epmet.exception.AesException;
import com.epmet.service.WarrantService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@ -15,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
/**

33
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeAuditResultDao.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.CodeAuditResultEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 代码审核j结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Mapper
public interface CodeAuditResultDao extends BaseDao<CodeAuditResultEntity> {
}

33
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeCustomerDao.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.CodeCustomerEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户代码关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Mapper
public interface CodeCustomerDao extends BaseDao<CodeCustomerEntity> {
}

33
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CodeMediaDao.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.CodeMediaEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 代码素材
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Mapper
public interface CodeMediaDao extends BaseDao<CodeMediaEntity> {
}

33
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerCodeOperationHistoryDao.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.CustomerCodeOperationHistoryEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户代码操作历史
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Mapper
public interface CustomerCodeOperationHistoryDao extends BaseDao<CustomerCodeOperationHistoryEntity> {
}

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

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerMpDTO;
import com.epmet.entity.CustomerMpEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户小程序关系表
@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface CustomerMpDao extends BaseDao<CustomerMpEntity> {
/**
* @param customerId
* @return
* @Author sun
* @Description 查询客户小程序授权结果信息
**/
List<CustomerMpDTO> selectByCustomerId(@Param("customerId") String customerId);
}

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

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaCustomerAgencyDTO;
import com.epmet.entity.PaCustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -38,4 +39,11 @@ public interface PaCustomerAgencyDao extends BaseDao<PaCustomerAgencyEntity> {
*/
String getCustomerIdByUserId(@Param("userId")String userId);
/**
* @param customerId
* @return
* @Author sun
* @Description 公众号-查询客户组织信息
**/
PaCustomerAgencyDTO selectCustomerAgency(@Param("customerId") String customerId);
}

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

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.entity.PaCustomerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户信息
@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PaCustomerDao extends BaseDao<PaCustomerEntity> {
/**
* @param userId
* @return
* @Author sun
* @Description 公众号-根据userId查询用户对应的客户信息
**/
List<PaCustomerDTO> selectCustomerByUserId(@Param("userId") String userId);
}

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

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaUserDTO;
import com.epmet.entity.PaUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 公众号用户信息
@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PaUserDao extends BaseDao<PaUserEntity> {
/**
* @param phone
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
**/
List<PaUserDTO> selectUserByPhone(@Param("phone") String phone);
}

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

@ -18,8 +18,10 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaUserWechatDTO;
import com.epmet.entity.PaUserWechatEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 公众号用户信息
@ -29,5 +31,20 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PaUserWechatDao extends BaseDao<PaUserWechatEntity> {
/**
* @param openId
* @return
* @Author sun
* @Description 根据openId查询user_wechat表信息
**/
PaUserWechatDTO selectWechatByOpenId(@Param("openId") String openId);
/**
* @param dto
* @return
* @Author sun
* @Description 根据userId查询user_wechat表信息
**/
PaUserWechatEntity selectWechatByUserId(PaUserWechatDTO dto);
}

66
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeAuditResultEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 代码审核j结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("code_audit_result")
public class CodeAuditResultEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 代码ID
*/
private String codeId;
/**
* 审核ID
*/
private String auditId;
/**
* 审核结果 审核中:auditing审核成功audit_success审核被拒绝audit_failed已撤回:withdrawn审核延后:delay
*/
private String result;
/**
* 原因
*/
private String reason;
}

91
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户代码关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("code_customer")
public class CodeCustomerEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户名
*/
private String customerName;
/**
* 小程序接口调用令牌ID
*/
private String accessTokenId;
/**
* 模板ID
*/
private String templateId;
/**
* 小程序类型 居民端resi,工作端work
*/
private String type;
/**
* APPID
*/
private String appId;
/**
* 自定义配置
*/
private String extJson;
/**
* 代码版本号
*/
private String userVersion;
/**
* 代码描述
*/
private String userDesc;
/**
* 状态 未审核:unaudited审核中:auditing审核成功audit_success审核被拒绝audit_failed已撤回:withdrawn审核延后:delay发布成功release_success, 发布失败release_failed
*/
private String status;
}

61
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeMediaEntity.java

@ -0,0 +1,61 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 代码素材
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("code_media")
public class CodeMediaEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 代码ID
*/
private String codeId;
/**
* 素材ID
*/
private String mediaId;
/**
* 素材名
*/
private String mediaName;
/**
* 素材类型 图片image语音voice视频video和缩略图thumb
*/
private String mediaType;
}

66
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerCodeOperationHistoryEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户代码操作历史
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("customer_code_operation_history")
public class CustomerCodeOperationHistoryEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 代码ID
*/
private String codeId;
/**
* 版本
*/
private String version;
/**
* 操作类型 操作 上传upload审核audit撤回undo发布release
*/
private String operation;
/**
* 描述
*/
private String describe;
}

7
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CustomerMpEntity.java

@ -54,13 +54,8 @@ public class CustomerMpEntity extends BaseEpmetEntity {
private Integer appId;
/**
* 是否已经授权
* 是否已经授权 0未授权1已授权
*/
private Integer authorizationFlag;
/**
* 公众账号信息id
*/
private String authorizerInfoId;
}

10
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PaUserWechatEntity.java

@ -53,11 +53,6 @@ public class PaUserWechatEntity extends BaseEpmetEntity {
*/
private String unionId;
/**
* 手机号
*/
private String phone;
/**
* 1男2女0未知
*/
@ -88,11 +83,6 @@ public class PaUserWechatEntity extends BaseEpmetEntity {
*/
private String city;
/**
* 用户特权信息json 数组如微信沃卡用户为chinaunicom
*/
private String privilege;
/**
* 语言
*/

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/CustomerMpExcel.java

@ -43,12 +43,9 @@ public class CustomerMpExcel {
@Excel(name = "小程序的appId")
private Integer appId;
@Excel(name = "是否已经授权")
@Excel(name = "是否已经授权:0.未授权 1.已授权")
private Integer authorizationFlag;
@Excel(name = "公众账号信息id")
private String authorizerInfoId;
@Excel(name = "删除标识:0.未删除 1.已删除")
private Integer delFlag;

6
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/excel/PaUserWechatExcel.java

@ -43,9 +43,6 @@ public class PaUserWechatExcel {
@Excel(name = "")
private String unionId;
@Excel(name = "手机号")
private String phone;
@Excel(name = "1男2女0未知")
private String gender;
@ -64,9 +61,6 @@ public class PaUserWechatExcel {
@Excel(name = "城市")
private String city;
@Excel(name = "用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)")
private String privilege;
@Excel(name = "语言")
private String language;

47
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeAuditResultRedis.java

@ -0,0 +1,47 @@
/**
* 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.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 代码审核j结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Component
public class CodeAuditResultRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeCustomerRedis.java

@ -0,0 +1,47 @@
/**
* 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.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 客户代码关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Component
public class CodeCustomerRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CodeMediaRedis.java

@ -0,0 +1,47 @@
/**
* 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.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 代码素材
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Component
public class CodeMediaRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/CustomerCodeOperationHistoryRedis.java

@ -0,0 +1,47 @@
/**
* 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.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 客户代码操作历史
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Component
public class CustomerCodeOperationHistoryRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeAuditResultService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CodeAuditResultDTO;
import com.epmet.entity.CodeAuditResultEntity;
import java.util.List;
import java.util.Map;
/**
* 代码审核j结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
public interface CodeAuditResultService extends BaseService<CodeAuditResultEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CodeAuditResultDTO>
* @author generator
* @date 2020-07-09
*/
PageData<CodeAuditResultDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CodeAuditResultDTO>
* @author generator
* @date 2020-07-09
*/
List<CodeAuditResultDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return CodeAuditResultDTO
* @author generator
* @date 2020-07-09
*/
CodeAuditResultDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void save(CodeAuditResultDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void update(CodeAuditResultDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-09
*/
void delete(String[] ids);
}

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

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CodeCustomerDTO;
import com.epmet.entity.CodeCustomerEntity;
import java.util.List;
import java.util.Map;
/**
* 客户代码关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
public interface CodeCustomerService extends BaseService<CodeCustomerEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CodeCustomerDTO>
* @author generator
* @date 2020-07-09
*/
PageData<CodeCustomerDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CodeCustomerDTO>
* @author generator
* @date 2020-07-09
*/
List<CodeCustomerDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return CodeCustomerDTO
* @author generator
* @date 2020-07-09
*/
CodeCustomerDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void save(CodeCustomerDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void update(CodeCustomerDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-09
*/
void delete(String[] ids);
}

95
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeMediaService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CodeMediaDTO;
import com.epmet.entity.CodeMediaEntity;
import java.util.List;
import java.util.Map;
/**
* 代码素材
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
public interface CodeMediaService extends BaseService<CodeMediaEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CodeMediaDTO>
* @author generator
* @date 2020-07-09
*/
PageData<CodeMediaDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CodeMediaDTO>
* @author generator
* @date 2020-07-09
*/
List<CodeMediaDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return CodeMediaDTO
* @author generator
* @date 2020-07-09
*/
CodeMediaDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void save(CodeMediaDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void update(CodeMediaDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-09
*/
void delete(String[] ids);
}

12
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeService.java

@ -0,0 +1,12 @@
package com.epmet.service;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/10 10:27
*/
public interface CodeService {
}

95
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CustomerCodeOperationHistoryService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerCodeOperationHistoryDTO;
import com.epmet.entity.CustomerCodeOperationHistoryEntity;
import java.util.List;
import java.util.Map;
/**
* 客户代码操作历史
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
public interface CustomerCodeOperationHistoryService extends BaseService<CustomerCodeOperationHistoryEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CustomerCodeOperationHistoryDTO>
* @author generator
* @date 2020-07-09
*/
PageData<CustomerCodeOperationHistoryDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CustomerCodeOperationHistoryDTO>
* @author generator
* @date 2020-07-09
*/
List<CustomerCodeOperationHistoryDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return CustomerCodeOperationHistoryDTO
* @author generator
* @date 2020-07-09
*/
CustomerCodeOperationHistoryDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void save(CustomerCodeOperationHistoryDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-07-09
*/
void update(CustomerCodeOperationHistoryDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-07-09
*/
void delete(String[] ids);
}

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

@ -19,7 +19,14 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.form.CreateAgencyFormDTO;
import com.epmet.dto.form.MyInfoFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.result.AgencyLevelListResultDTO;
import com.epmet.dto.result.CreateAgencyResultDTO;
import com.epmet.dto.result.MyInfoResultDTO;
import com.epmet.entity.PaCustomerEntity;
import java.util.List;
@ -92,4 +99,36 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
* @date 2020-07-09
*/
void delete(String[] ids);
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
void register(RegisterFormDTO formDTO);
/**
* @return
* @Author sun
* @Description 公众号-查询组织级别
**/
List<AgencyLevelListResultDTO> agencyLevelList();
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-创建组织
**/
CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-查询我的信息
**/
MyInfoResultDTO myInfo(MyInfoFormDTO formDTO);
}

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

@ -20,7 +20,10 @@ 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.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;
@ -92,4 +95,20 @@ public interface PaUserService extends BaseService<PaUserEntity> {
* @date 2020-07-09
*/
void delete(String[] ids);
/**
* @param wxMpUser
* @return
* @Author sun
* @Description 根据openId新增或更新用户信息
**/
SaveUserResultDTO saveUser(WxMpUser wxMpUser);
/**
* @param phone
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
**/
CustomerUserResultDTO checkPaUser(String phone);
}

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaUserVisitedService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PaUserVisitedDTO;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.entity.PaUserVisitedEntity;
import java.util.List;
@ -92,4 +93,12 @@ public interface PaUserVisitedService extends BaseService<PaUserVisitedEntity> {
* @date 2020-07-09
*/
void delete(String[] ids);
/**
* @param visited
* @return
* @Author sun
* @Description 用户登陆新增访问记录数据
**/
void saveUserVisited(SaveUserVisitedFormDTO visited);
}

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

@ -92,4 +92,12 @@ public interface PaUserWechatService extends BaseService<PaUserWechatEntity> {
* @date 2020-07-09
*/
void delete(String[] ids);
/**
* @param openId
* @return
* @Author sun
* @Description 根据openId查询user_wechat表信息
**/
PaUserWechatDTO getWechatByOpenId(String openId);
}

104
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeAuditResultServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.CodeAuditResultDao;
import com.epmet.dto.CodeAuditResultDTO;
import com.epmet.entity.CodeAuditResultEntity;
import com.epmet.redis.CodeAuditResultRedis;
import com.epmet.service.CodeAuditResultService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 代码审核j结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Service
public class CodeAuditResultServiceImpl extends BaseServiceImpl<CodeAuditResultDao, CodeAuditResultEntity> implements CodeAuditResultService {
@Autowired
private CodeAuditResultRedis codeAuditResultRedis;
@Override
public PageData<CodeAuditResultDTO> page(Map<String, Object> params) {
IPage<CodeAuditResultEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, CodeAuditResultDTO.class);
}
@Override
public List<CodeAuditResultDTO> list(Map<String, Object> params) {
List<CodeAuditResultEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CodeAuditResultDTO.class);
}
private QueryWrapper<CodeAuditResultEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<CodeAuditResultEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public CodeAuditResultDTO get(String id) {
CodeAuditResultEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, CodeAuditResultDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CodeAuditResultDTO dto) {
CodeAuditResultEntity entity = ConvertUtils.sourceToTarget(dto, CodeAuditResultEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(CodeAuditResultDTO dto) {
CodeAuditResultEntity entity = ConvertUtils.sourceToTarget(dto, CodeAuditResultEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

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

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.CodeCustomerDao;
import com.epmet.dto.CodeCustomerDTO;
import com.epmet.entity.CodeCustomerEntity;
import com.epmet.redis.CodeCustomerRedis;
import com.epmet.service.CodeCustomerService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 客户代码关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Service
public class CodeCustomerServiceImpl extends BaseServiceImpl<CodeCustomerDao, CodeCustomerEntity> implements CodeCustomerService {
@Autowired
private CodeCustomerRedis codeCustomerRedis;
@Override
public PageData<CodeCustomerDTO> page(Map<String, Object> params) {
IPage<CodeCustomerEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, CodeCustomerDTO.class);
}
@Override
public List<CodeCustomerDTO> list(Map<String, Object> params) {
List<CodeCustomerEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CodeCustomerDTO.class);
}
private QueryWrapper<CodeCustomerEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<CodeCustomerEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public CodeCustomerDTO get(String id) {
CodeCustomerEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, CodeCustomerDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CodeCustomerDTO dto) {
CodeCustomerEntity entity = ConvertUtils.sourceToTarget(dto, CodeCustomerEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(CodeCustomerDTO dto) {
CodeCustomerEntity entity = ConvertUtils.sourceToTarget(dto, CodeCustomerEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

104
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeMediaServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.CodeMediaDao;
import com.epmet.dto.CodeMediaDTO;
import com.epmet.entity.CodeMediaEntity;
import com.epmet.redis.CodeMediaRedis;
import com.epmet.service.CodeMediaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 代码素材
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Service
public class CodeMediaServiceImpl extends BaseServiceImpl<CodeMediaDao, CodeMediaEntity> implements CodeMediaService {
@Autowired
private CodeMediaRedis codeMediaRedis;
@Override
public PageData<CodeMediaDTO> page(Map<String, Object> params) {
IPage<CodeMediaEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, CodeMediaDTO.class);
}
@Override
public List<CodeMediaDTO> list(Map<String, Object> params) {
List<CodeMediaEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CodeMediaDTO.class);
}
private QueryWrapper<CodeMediaEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<CodeMediaEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public CodeMediaDTO get(String id) {
CodeMediaEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, CodeMediaDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CodeMediaDTO dto) {
CodeMediaEntity entity = ConvertUtils.sourceToTarget(dto, CodeMediaEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(CodeMediaDTO dto) {
CodeMediaEntity entity = ConvertUtils.sourceToTarget(dto, CodeMediaEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

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

@ -0,0 +1,17 @@
package com.epmet.service.impl;
import com.epmet.service.CodeService;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/10 10:27
*/
@Service
public class CodeServiceImpl implements CodeService {
}

104
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CustomerCodeOperationHistoryServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.CustomerCodeOperationHistoryDao;
import com.epmet.dto.CustomerCodeOperationHistoryDTO;
import com.epmet.entity.CustomerCodeOperationHistoryEntity;
import com.epmet.redis.CustomerCodeOperationHistoryRedis;
import com.epmet.service.CustomerCodeOperationHistoryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 客户代码操作历史
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-09
*/
@Service
public class CustomerCodeOperationHistoryServiceImpl extends BaseServiceImpl<CustomerCodeOperationHistoryDao, CustomerCodeOperationHistoryEntity> implements CustomerCodeOperationHistoryService {
@Autowired
private CustomerCodeOperationHistoryRedis customerCodeOperationHistoryRedis;
@Override
public PageData<CustomerCodeOperationHistoryDTO> page(Map<String, Object> params) {
IPage<CustomerCodeOperationHistoryEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, CustomerCodeOperationHistoryDTO.class);
}
@Override
public List<CustomerCodeOperationHistoryDTO> list(Map<String, Object> params) {
List<CustomerCodeOperationHistoryEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CustomerCodeOperationHistoryDTO.class);
}
private QueryWrapper<CustomerCodeOperationHistoryEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<CustomerCodeOperationHistoryEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public CustomerCodeOperationHistoryDTO get(String id) {
CustomerCodeOperationHistoryEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, CustomerCodeOperationHistoryDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CustomerCodeOperationHistoryDTO dto) {
CustomerCodeOperationHistoryEntity entity = ConvertUtils.sourceToTarget(dto, CustomerCodeOperationHistoryEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(CustomerCodeOperationHistoryDTO dto) {
CustomerCodeOperationHistoryEntity entity = ConvertUtils.sourceToTarget(dto, CustomerCodeOperationHistoryEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

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

@ -19,20 +19,41 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.PaCustomerDao;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.entity.PaCustomerEntity;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.constant.PaConstant;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.CreateAgencyFormDTO;
import com.epmet.dto.form.MyInfoFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.result.AgencyLevelListResultDTO;
import com.epmet.dto.result.CreateAgencyResultDTO;
import com.epmet.dto.result.MyInfoResultDTO;
import com.epmet.entity.*;
import com.epmet.redis.PaCustomerRedis;
import com.epmet.service.CustomerMpService;
import com.epmet.service.PaCustomerAgencyService;
import com.epmet.service.PaCustomerService;
import com.epmet.service.PaCustomerUserAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -46,8 +67,29 @@ import java.util.Map;
@Service
public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCustomerEntity> implements PaCustomerService {
private Logger logger = LogManager.getLogger(PaCustomerServiceImpl.class);
@Autowired
private PaCustomerRedis paCustomerRedis;
@Autowired
private PaUserDao paUserDao;
@Autowired
private PaUserWechatDao paUserWechatDao;
@Autowired
private PaUserVisitedDao paUserVisitedDao;
@Autowired
private PaCustomerAgencyDao paCustomerAgencyDao;
@Autowired
private CustomerMpDao customerMpDao;
@Autowired
private RedisUtils redisUtils;
@Autowired
private PaCustomerAgencyService paCustomerAgencyService;
@Autowired
private PaCustomerUserAgencyService paCustomerUserAgencyService;
@Autowired
private CustomerMpService customerMpService;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Override
public PageData<PaCustomerDTO> page(Map<String, Object> params) {
@ -65,8 +107,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
return ConvertUtils.sourceToTarget(entityList, PaCustomerDTO.class);
}
private QueryWrapper<PaCustomerEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
private QueryWrapper<PaCustomerEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<PaCustomerEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
@ -101,4 +143,184 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void register(RegisterFormDTO formDTO) {
//1.根据手机号查询到用户信息,判断用户是否存
List<PaUserDTO> userList = paUserDao.selectUserByPhone(formDTO.getPhone());
if (null != userList && userList.size() > NumConstant.ZERO) {
throw new RenException(PaConstant.PHONE_EXCEPTION);
}
//2.校验验证码是否正确
String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, formDTO.getPhone());
String rightSmsCode = (String) redisUtils.get(smsCodeKey);
if (!formDTO.getSmsCode().equals(rightSmsCode)) {
logger.error(String.format("验证码错误code[%s],msg[%s]", EpmetErrorCode.MOBILE_CODE_ERROR.getCode(), EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//3.pa_user表更新数据
PaUserEntity userEntity = new PaUserEntity();
userEntity.setId(formDTO.getUserId());
userEntity.setPhone(formDTO.getPhone());
userEntity.setRealName(formDTO.getSurName());
userEntity.setGender(formDTO.getGender().toString());
if (paUserDao.updateById(userEntity) < NumConstant.ONE) {
throw new RenException(PaConstant.UPDATE_USER_EXCEPTION);
}
//2.访问记录表新增数据
PaUserWechatDTO dto = new PaUserWechatDTO();
dto.setUserId(formDTO.getUserId());
PaUserWechatEntity wechatEntity = paUserWechatDao.selectWechatByUserId(dto);
if (null == wechatEntity) {
throw new RenException(PaConstant.SELECT_WECHAT_EXCEPTION);
}
PaUserVisitedEntity visitedEntity = new PaUserVisitedEntity();
visitedEntity.setUserId(formDTO.getUserId());
visitedEntity.setWxOpenId(wechatEntity.getWxOpenId());
visitedEntity.setOpenId(wechatEntity.getWxOpenId());
visitedEntity.setPhone(formDTO.getPhone());
if (paUserVisitedDao.insert(visitedEntity) < NumConstant.ONE) {
throw new RenException(PaConstant.SAVE_VISITED_EXCEPTION);
}
}
/**
* @return
* @Author sun
* @Description 公众号-查询组织级别
**/
@Override
public List<AgencyLevelListResultDTO> agencyLevelList() {
List<AgencyLevelListResultDTO> list = new ArrayList<>();
AgencyLevelListResultDTO dto1 = new AgencyLevelListResultDTO();
dto1.setLevelKey(PaConstant.PROVINCE_KEY);
dto1.setLevelName(PaConstant.PROVINCE_NAME);
list.add(dto1);
AgencyLevelListResultDTO dto2 = new AgencyLevelListResultDTO();
dto2.setLevelKey(PaConstant.CITY_KEY);
dto2.setLevelName(PaConstant.CITY_NAME);
list.add(dto2);
AgencyLevelListResultDTO dto3 = new AgencyLevelListResultDTO();
dto3.setLevelKey(PaConstant.STREET_KEY);
dto3.setLevelName(PaConstant.STREET_NAME);
list.add(dto3);
AgencyLevelListResultDTO dto4 = new AgencyLevelListResultDTO();
dto4.setLevelKey(PaConstant.COMMUNITY_KEY);
dto4.setLevelName(PaConstant.COMMUNITY_NAME);
list.add(dto4);
return list;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-创建组织
**/
@Override
@Transactional(rollbackFor = Exception.class)
public CreateAgencyResultDTO createAgency(TokenDto tokenDTO, CreateAgencyFormDTO formDTO) {
//1.客户表初始化数据
PaCustomerEntity entity = new PaCustomerEntity();
entity.setCustomerName(formDTO.getAgencyName());
baseDao.insert(entity);
//2.客户组织表初始化数据
PaCustomerAgencyEntity agencyEntity = new PaCustomerAgencyEntity();
agencyEntity.setCustomerId(entity.getId());
agencyEntity.setAgencyName(formDTO.getAgencyName());
agencyEntity.setLevel(formDTO.getLevel());
agencyEntity.setAreaCode(formDTO.getAreaCode());
agencyEntity.setProvince(formDTO.getProvince());
agencyEntity.setCity(formDTO.getCity());
agencyEntity.setDistrict(formDTO.getDistrict());
agencyEntity.setPartybranchnum(formDTO.getPartyBranchNum());
paCustomerAgencyService.insert(agencyEntity);
//3.客户组织用户关系表初始化数据
PaCustomerUserAgencyEntity cuaEntity = new PaCustomerUserAgencyEntity();
cuaEntity.setCustomerId(entity.getId());
cuaEntity.setAgencyId(agencyEntity.getId());
cuaEntity.setUserId(tokenDTO.getUserId());
paCustomerUserAgencyService.insert(cuaEntity);
//4.客户小程序关系表初始化数据
List<CustomerMpEntity> listEntity = new ArrayList<>();
CustomerMpEntity mpEntity1 = new CustomerMpEntity();
mpEntity1.setCustomerId(entity.getId());
mpEntity1.setAuthorizationFlag(NumConstant.ZERO);
mpEntity1.setClient(PaConstant.RESI_CLIENT);
listEntity.add(mpEntity1);
CustomerMpEntity mpEntity2 = ConvertUtils.sourceToTarget(mpEntity1, CustomerMpEntity.class);
mpEntity2.setClient(PaConstant.WORK_CLIENT);
listEntity.add(mpEntity2);
customerMpService.insertBatch(listEntity);
//5.token中添加customerId
//5-1.获取redis中的token
//获取缓存中的token
TokenDto redisTokenDTO = cpUserDetailRedis.get(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, tokenDTO.getUserId(), TokenDto.class);
if (redisTokenDTO == null) {
throw new RenException(PaConstant.TOKEN_EXCEPTION);
}
//5-2.添加customerId
redisTokenDTO.setCustomerId(entity.getId());
//获取key的剩余过期时间
String key = RedisKeys.getCpUserKey(LoginConstant.APP_PUBLIC, LoginConstant.CLIENT_MP, tokenDTO.getUserId());
long expire = redisUtils.getExpire(key);
cpUserDetailRedis.set(redisTokenDTO, expire);
//6.接口返参
CreateAgencyResultDTO resultDTO = new CreateAgencyResultDTO();
resultDTO.setCustomerId(entity.getId());
resultDTO.setToken(redisTokenDTO.getToken());
return resultDTO;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-查询我的信息
**/
@Override
public MyInfoResultDTO myInfo(MyInfoFormDTO formDTO) {
//1.查询客户组织信息
PaCustomerAgencyDTO agencyDTO = paCustomerAgencyDao.selectCustomerAgency(formDTO.getCustomerId());
if (null == agencyDTO) {
throw new RenException(PaConstant.SELECT_AGENCY_EXCEPTION);
}
//2.查询客户小程序授权结果信息
List<CustomerMpDTO> listMpDTO = customerMpDao.selectByCustomerId(formDTO.getCustomerId());
if (null == agencyDTO || listMpDTO.size() != NumConstant.TWO) {
throw new RenException(PaConstant.CUSTOMER_MP_EXCEPTION);
}
//3.封装结果信息
MyInfoResultDTO resultDTO = ConvertUtils.sourceToTarget(agencyDTO, MyInfoResultDTO.class);
resultDTO.setPartyBranchNum(agencyDTO.getPartybranchnum());
for (CustomerMpDTO mp : listMpDTO) {
if (PaConstant.CLIENT_RESI.equals(mp.getClient())) {
resultDTO.setResiAuthorization(mp.getAuthorizationFlag());
}
if (PaConstant.CLIENT_WORK.equals(mp.getClient())) {
resultDTO.setWorkAuthorization(mp.getAuthorizationFlag());
}
}
return resultDTO;
}
}

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

@ -20,14 +20,23 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.PaCustomerDao;
import com.epmet.dao.PaUserDao;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.PaUserWechatDTO;
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.PaUserWechatService;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -48,6 +57,10 @@ public class PaUserServiceImpl extends BaseServiceImpl<PaUserDao, PaUserEntity>
@Autowired
private PaUserRedis paUserRedis;
@Autowired
private PaUserWechatService paUserWechatService;
@Autowired
private PaCustomerDao paCustomerDao;
@Override
public PageData<PaUserDTO> page(Map<String, Object> params) {
@ -101,4 +114,80 @@ public class PaUserServiceImpl extends BaseServiceImpl<PaUserDao, PaUserEntity>
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param wxMpUser
* @return
* @Author sun
* @Description 根据openId新增或更新用户信息
**/
@Override
@Transactional(rollbackFor = Exception.class)
public SaveUserResultDTO saveUser(WxMpUser wxMpUser) {
SaveUserResultDTO resultDTO = new SaveUserResultDTO();
//1.根据openId查询user_wechat表是否存在用户信息
PaUserWechatDTO wechatDTO = paUserWechatService.getWechatByOpenId(wxMpUser.getOpenId());
//2.不存在则新增用户信息,存在则更新user_wechat表信息
if (null == wechatDTO || null == wechatDTO.getId()) {
//2.1、user表新增数据
PaUserEntity userEntity = new PaUserEntity();
baseDao.insert(userEntity);
//2.2、user_wechat表新增数据
PaUserWechatEntity wechatEntity = new PaUserWechatEntity();
wechatEntity.setUserId(userEntity.getId());
wechatEntity.setWxOpenId(wxMpUser.getOpenId());
wechatEntity.setUnionId(wxMpUser.getUnionId());
wechatEntity.setGender(wxMpUser.getSex().toString());
wechatEntity.setNickname(wxMpUser.getNickname());
wechatEntity.setHeadImgUrl(wxMpUser.getHeadImgUrl());
wechatEntity.setCountry(wxMpUser.getCountry());
wechatEntity.setProvince(wxMpUser.getProvince());
wechatEntity.setCity(wxMpUser.getCity());
wechatEntity.setLanguage(wxMpUser.getLanguage());
paUserWechatService.insert(wechatEntity);
resultDTO.setUserId(userEntity.getId());
} else {
//2.3、更新user_wechat表数据
PaUserWechatEntity wechatEntity = ConvertUtils.sourceToTarget(wechatDTO, PaUserWechatEntity.class);
wechatEntity.setGender(wxMpUser.getSex().toString());
wechatEntity.setNickname(wxMpUser.getNickname());
wechatEntity.setHeadImgUrl(wxMpUser.getHeadImgUrl());
wechatEntity.setCountry(wxMpUser.getCountry());
wechatEntity.setProvince(wxMpUser.getProvince());
wechatEntity.setCity(wxMpUser.getCity());
wechatEntity.setLanguage(wxMpUser.getLanguage());
paUserWechatService.updateById(wechatEntity);
resultDTO.setUserId(wechatDTO.getUserId());
}
//3.返回userId
return resultDTO;
}
/**
* @param phone
* @return
* @Author sun
* @Description 根据手机号查询公众号用户基本信息校验用户是否存在
**/
@Override
public CustomerUserResultDTO checkPaUser(String phone) {
CustomerUserResultDTO resultDTO = new CustomerUserResultDTO();
List<PaUserDTO> userList = baseDao.selectUserByPhone(phone);
if (null == userList || userList.size() < NumConstant.ONE) {
resultDTO.setPaUserResult(null);
resultDTO.setPaCustomerResult(null);
return resultDTO;
}
PaUserDTO dto = userList.get(NumConstant.ZERO);
List<PaCustomerDTO> customerList = paCustomerDao.selectCustomerByUserId(dto.getId());
resultDTO.setPaUserResult(dto);
resultDTO.setPaCustomerResult(customerList.size() > NumConstant.ZERO ? customerList.get(NumConstant.ZERO) : null);
return resultDTO;
}
}

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

@ -20,12 +20,16 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.PaUserVisitedDao;
import com.epmet.dao.PaUserWechatDao;
import com.epmet.dto.PaUserVisitedDTO;
import com.epmet.dto.PaUserWechatDTO;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.entity.PaUserVisitedEntity;
import com.epmet.entity.PaUserWechatEntity;
import com.epmet.redis.PaUserVisitedRedis;
import com.epmet.service.PaUserVisitedService;
import org.apache.commons.lang3.StringUtils;
@ -48,6 +52,8 @@ public class PaUserVisitedServiceImpl extends BaseServiceImpl<PaUserVisitedDao,
@Autowired
private PaUserVisitedRedis paUserVisitedRedis;
@Autowired
private PaUserWechatDao paUserWechatDao;
@Override
public PageData<PaUserVisitedDTO> page(Map<String, Object> params) {
@ -101,4 +107,35 @@ public class PaUserVisitedServiceImpl extends BaseServiceImpl<PaUserVisitedDao,
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param visited
* @return
* @Author sun
* @Description 用户登陆新增访问记录数据
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveUserVisited(SaveUserVisitedFormDTO visited) {
PaUserWechatDTO dto = new PaUserWechatDTO();
//1.查询登陆手机号对应的用户微信信息
dto.setUserId(visited.getUserId());
PaUserWechatEntity userEntity = paUserWechatDao.selectWechatByUserId(dto);
//2.查询当前登陆人对应的微信信息
String openId = userEntity.getWxOpenId();
if(!visited.getUserId().equals(visited.getLogonUserId())){
dto.setUserId(visited.getLogonUserId());
PaUserWechatEntity logonUser = paUserWechatDao.selectWechatByUserId(dto);
openId = logonUser.getWxOpenId();
}
//3.新增访问记录数据
PaUserVisitedEntity entity = new PaUserVisitedEntity();
entity.setUserId(visited.getUserId());
entity.setWxOpenId(userEntity.getWxOpenId());
entity.setOpenId(openId);
entity.setPhone(visited.getPhone());
baseDao.insert(entity);
}
}

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

@ -101,4 +101,15 @@ public class PaUserWechatServiceImpl extends BaseServiceImpl<PaUserWechatDao, Pa
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param openId
* @return
* @Author sun
* @Description 根据openId查询user_wechat表信息
**/
@Override
public PaUserWechatDTO getWechatByOpenId(String openId) {
return baseDao.selectWechatByOpenId(openId);
}
}

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

@ -6,7 +6,7 @@ package com.epmet.wxapi.constant;
* @author yinzuomei@elink-cn.com
* @date 2020/7/10 12:57
*/
public class WxMaCodeConstant {
public interface WxMaCodeConstant {
/**
* 为授权的小程序帐号上传小程序代码.
*/

9
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatus.java

@ -0,0 +1,9 @@
package com.epmet.wxapi.param;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/10 18:05
*/
public class WxMaCodeAuditStatus {
}

18
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeAuditStatusReq.java

@ -0,0 +1,18 @@
package com.epmet.wxapi.param;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/13 15:49
*/
@Data
public class WxMaCodeAuditStatusReq implements Serializable {
private static final long serialVersionUID = -504705519949598098L;
@SerializedName("auditid")
private String auditId;
}

10
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeCommitReq.java

@ -1,5 +1,6 @@
package com.epmet.wxapi.param;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;
@ -17,18 +18,23 @@ public class WxMaCodeCommitReq implements Serializable {
/**
* 代码库中的代码模版ID
*/
private Long templateId;
@SerializedName("template_id")
private String templateId;
/**
* 第三方自定义的配置
*/
private WxMaCodeExtConfigReq extConfig;
@SerializedName("ext_json")
private String extJson;
/**
* 代码版本号开发者可自定义
*/
@SerializedName("user_version")
private String userVersion;
/**
* 代码描述开发者可自定义
*/
@SerializedName("user_desc")
private String userDesc;
}

145
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java

@ -0,0 +1,145 @@
package com.epmet.wxapi.param;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/10 18:04
*/
@NoArgsConstructor
@Data
public class WxMaCodeSubmitAuditRequest implements Serializable {
private static final long serialVersionUID = -3919598581372634816L;
/**
* 小程序版本说明和功能解释
*/
@SerializedName("version_desc")
private String versionDesc;
/**
* 反馈内容至多 200
*/
@SerializedName("feedback_info")
private String feedbackInfo;
/**
* | 分割的 media_id 列表至多 5 张图片, 可以通过新增临时素材接口上传而得到
*/
@SerializedName("feedback_stuff")
private String feedbackStuff;
/**
* 审核项列表选填至多填写 5
*/
@SerializedName("item_list")
private List<ItemListBean> itemList;
/**
* 预览信息小程序页面截图和操作录屏
*/
@SerializedName("preview_info")
private List<PreviewInfoBean> previewInfo;
/**
* 用户生成内容场景UGC信息安全声明
*/
@SerializedName("ugc_declare")
private List<UgcDeclareBean> ugcDeclare;
@NoArgsConstructor
@Data
private static class ItemListBean {
/**
* 小程序的页面可通过获取小程序的页面列表接口获得
*/
@SerializedName("address")
private String address;
/**
* 小程序的标签用空格分隔标签至多 10 标签长度至多 20
*/
@SerializedName("tag")
private String tag;
/**
* 一级类目名称
*/
@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;
/**
* 小程序页面的标题,标题长度至多 32
*/
@SerializedName("title")
private String title;
}
@NoArgsConstructor
@Data
private static class PreviewInfoBean {
/**
* 录屏mediaid列表可以通过提审素材上传接口获得
*/
@SerializedName("Video_id_list")
private List<String> videoIdList;
/**
* 截屏mediaid列表可以通过提审素材上传接口获得
*/
@SerializedName("pic_id_list")
private List<String> picIdList;
}
@NoArgsConstructor
@Data
private static class UgcDeclareBean {
/**
* UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段
*/
@SerializedName("scene")
private List<Integer> scene;
/**
* 当scene选其他时的说明,不超时256字
*/
@SerializedName("other_scene_desc")
private String otherSceneDesc;
/**
* 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关
*/
@SerializedName("method")
private List<Integer> method;
/**
* 是否有审核团队, 0.,1.,默认0
*/
@SerializedName("has_audit_team")
private Integer hasAuditTeam;
/**
* 说明当前对UGC内容的审核机制,不超过256字
*/
@SerializedName("audit_desc")
private String auditDesc;
}
}

36
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaAuditStatusResult.java

@ -0,0 +1,36 @@
package com.epmet.wxapi.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/13 15:53
*/
@Data
public class WxMaAuditStatusResult implements Serializable {
private static final long serialVersionUID = 3461409352381952089L;
/**
* 返回码
*/
private String errcode;
/**
* 错误信息
*/
private String errmsg;
/**
* 审核状态
*/
private Integer status;
/**
* status = 1 返回的拒绝原因; status = 4 返回的延后原因
*/
private String reason;
/**
* status = 1 会返回审核失败的小程序截图示例 | 分隔的 media_id 的列表可通过获取永久素材接口拉取截图内容
*/
private String screenshot;
}

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

@ -0,0 +1,52 @@
package com.epmet.wxapi.result;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/10 16:51
*/
@Data
public class WxMaCategoryResult implements Serializable {
/**
* 一级类目名称
*/
private String firstClass;
/**
* 二级类目名称
*/
private String secondClass;
/**
* 三级类目名称
*/
private String thirdClass;
/**
* 一级类目的ID编号
*/
private String firstId;
/**
* 二级类目的ID编号
*/
private String secondId;
/**
* 三级类目的ID编号
*/
private String thirdId;
/**
* 小程序的页面可通过获取小程序的第三方提交代码的页面配置接口获得
*/
private String address;
/**
* 小程序的标签多个标签用空格分隔标签不能多于10个标签长度不超过20
*/
private String tag;
/**
* 小程序页面的标题,标题长度不超过32
*/
private String title;
}

28
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetCategoryResult.java

@ -0,0 +1,28 @@
package com.epmet.wxapi.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/13 10:17
*/
@Data
public class WxMaGetCategoryResult implements Serializable {
private static final long serialVersionUID = -2665257152145041516L;
/**
* 返回码
*/
private Integer errcode;
/**
* 错误信息
*/
private String errmsg;
/**
* 可填选的类目信息列表
*/
private List<WxMaCategoryResult> categoryList;
}

28
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxMaGetPageResult.java

@ -0,0 +1,28 @@
package com.epmet.wxapi.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/7/13 13:38
*/
@Data
public class WxMaGetPageResult implements Serializable {
private static final long serialVersionUID = -3057343239059623208L;
/**
* 返回码
*/
private Integer errcode;
/**
* 错误信息
*/
private String errmsg;
/**
* 错误信息
*/
private List<String> pageList;
}

76
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java

@ -1,9 +1,15 @@
package com.epmet.wxapi.service;
import com.epmet.wxapi.param.WxMaCodeAuditStatus;
import com.epmet.wxapi.param.WxMaCodeAuditStatusReq;
import com.epmet.wxapi.param.WxMaCodeCommitReq;
import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest;
import com.epmet.wxapi.result.WxMaCategoryResult;
import com.epmet.wxapi.result.WxResult;
import me.chanjar.weixin.common.error.WxErrorException;
import java.util.List;
/**
* 小程序代码管理相关 API大部分只能是第三方平台调用
* 文档https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489140610_Uavc4&token=&lang=zh_CN
@ -14,9 +20,73 @@ import me.chanjar.weixin.common.error.WxErrorException;
public interface WxMaCodeService {
/**
* 为授权的小程序帐号上传小程序代码仅仅支持第三方开放平台.
*
* @param commitRequest 参数
* @author zhaoqifeng
* @date 2020/7/10 14:11
* @param accessToken 小程序接口调用令牌
* @param commitRequest 请求参数
* @return com.epmet.wxapi.result.WxResult
* @throws WxErrorException 上传失败时抛出具体错误码请看类注释文档
*/
WxResult commit(String access_token, WxMaCodeCommitReq commitRequest) throws WxErrorException;
WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest) throws WxErrorException;
/**
* 获取体验小程序的体验二维码.
* @author zhaoqifeng
* @date 2020/7/10 15:25
* @param accessToken 小程序接口调用令牌
* @param path 指定体验版二维码跳转到某个具体页面
* @return com.epmet.wxapi.result.WxResult
* @throws WxErrorException 抛出异常
*/
WxResult getQrCode(String accessToken, String path) throws WxErrorException;
/**
* 获取授权小程序帐号的可选类目.
*
* @param accessToken 提交审核参数
* @return List<WxMaCategory>
*/
WxResult getCategory(String accessToken);
/**
* 获取小程序的第三方提交代码的页面配置仅供第三方开发者代小程序调用.
*
* @param accessToken 提交审核参数
* @return page_list 页面配置列表
*/
WxResult getPage(String accessToken);
/**
* 将第三方提交的代码包提交审核仅供第三方开发者代小程序调用.
*
* @param accessToken 提交审核参数
* @param auditRequest 提交审核参数
* @return 审核编号
*/
WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest);
/**
* 查询指定版本审核状态仅供第三方代小程序调用.
*
* @param accessToken 提交审核参数
* @return 审核状态
*/
WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request);
/**
* 发布已通过审核的小程序仅供第三方代小程序调用.
*
* @param accessToken 提交审核参数
* @return 发布结果
*/
WxResult release(String accessToken);
/**
* 小程序审核撤回.
* 单个帐号每天审核撤回次数最多不超过1次一个月不超过10次
*
* @param accessToken 提交审核参数
* @return 撤回结果
*/
WxResult undoCodeAudit(String accessToken);
}

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

@ -1,11 +1,30 @@
package com.epmet.wxapi.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.wxapi.constant.WxMaCodeConstant;
import com.epmet.wxapi.param.WxMaCodeAuditStatus;
import com.epmet.wxapi.param.WxMaCodeAuditStatusReq;
import com.epmet.wxapi.param.WxMaCodeCommitReq;
import com.epmet.wxapi.result.WxResult;
import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest;
import com.epmet.wxapi.result.*;
import com.epmet.wxapi.service.WxMaCodeService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.micrometer.core.instrument.util.JsonUtils;
import lombok.Data;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
/**
* 描述一下
*
@ -14,9 +33,161 @@ import org.springframework.stereotype.Service;
*/
@Service
public class WxMaCodeServiceImpl implements WxMaCodeService {
private static final String ERR_CODE = "errcode";
private static final String ERR_MSG = "errmsg";
@Override
public WxResult commit(String accessToken, WxMaCodeCommitReq commitRequest) throws WxErrorException {
WxResult result = new WxResult();
String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken;
Result<String> commitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(commitRequest));
if(!commitResult.success()) {
result.setErrorCode(commitResult.getCode());
result.setErrorMsg(commitResult.getMsg());
return result;
}
JSONObject jsonObject = JSONObject.parseObject(commitResult.getData());
result.setErrorCode(jsonObject.getInteger(ERR_CODE));
result.setErrorMsg(jsonObject.getString(ERR_MSG));
return result;
}
@Override
public WxResult getQrCode(String accessToken, String path) throws WxErrorException{
WxResult<Byte[]> result = new WxResult<>();
StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token").append(accessToken);
if (StringUtils.isNotBlank(path)) {
try {
url.append("?path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
Result<Byte[]> qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null);
if(!qrCodeResult.success()) {
result.setErrorCode(qrCodeResult.getCode());
result.setErrorMsg(qrCodeResult.getMsg());
return result;
}
result.setData(qrCodeResult.getData());
return result;
}
@Override
public WxResult commit(String access_token, WxMaCodeCommitReq commitRequest) throws WxErrorException {
public WxResult getCategory(String accessToken) {
WxResult<List<WxMaCategoryResult>> result = new WxResult<>();
String url = WxMaCodeConstant.GET_CATEGORY_URL + "?" + "access_token=" + accessToken;
Result<String> getCategoryResult = HttpClientManager.getInstance().sendGet(url, null);
if(!getCategoryResult.success()) {
result.setErrorCode(getCategoryResult.getCode());
result.setErrorMsg(getCategoryResult.getMsg());
return result;
}
WxMaGetCategoryResult categoryResult = JSONObject.parseObject(getCategoryResult.getData(), WxMaGetCategoryResult.class);
result.setErrorCode(categoryResult.getErrcode());
result.setErrorMsg(categoryResult.getErrmsg());
result.setData(categoryResult.getCategoryList());
return result;
}
@Override
public WxResult getPage(String accessToken) {
WxResult<List<String>> result = new WxResult<>();
String url = WxMaCodeConstant.GET_PAGE_URL + "?" + "access_token=" + accessToken;
Result<String> getPageResult = HttpClientManager.getInstance().sendGet(url, null);
if(!getPageResult.success()) {
result.setErrorCode(getPageResult.getCode());
result.setErrorMsg(getPageResult.getMsg());
return result;
}
WxMaGetPageResult pageResult = JSONObject.parseObject(getPageResult.getData(), WxMaGetPageResult.class);
result.setErrorCode(pageResult.getErrcode());
result.setErrorMsg(pageResult.getErrmsg());
result.setData(pageResult.getPageList());
return result;
}
return null;
@Override
public WxResult submitAudit(String accessToken, WxMaCodeSubmitAuditRequest auditRequest) {
WxResult result = new WxResult();
String url = WxMaCodeConstant.SUBMIT_AUDIT_URL + "?" + "access_token=" + accessToken;
Result<String> submitResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(auditRequest));
if(!submitResult.success()) {
result.setErrorCode(submitResult.getCode());
result.setErrorMsg(submitResult.getMsg());
return result;
}
JSONObject jsonObject = JSONObject.parseObject(submitResult.getData());
result.setErrorCode(jsonObject.getInteger(ERR_CODE));
result.setErrorMsg(jsonObject.getString(ERR_MSG));
return result;
}
@Override
public WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) {
WxResult<WxMaAuditStatusResult> result = new WxResult<>();
String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken;
Result<String> statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request));
if(!statusResult.success()) {
result.setErrorCode(statusResult.getCode());
result.setErrorMsg(statusResult.getMsg());
return result;
}
WxMaAuditStatusResult auditStatusResult = JSONObject.parseObject(statusResult.getData(), WxMaAuditStatusResult.class);
result.ok(auditStatusResult);
return result;
}
@Override
public WxResult release(String accessToken) {
WxResult result = new WxResult();
String url = WxMaCodeConstant.RELEASE_URL + "?" + "access_token=" + accessToken;
Result<String> releaseResult = HttpClientManager.getInstance().sendPostByJSON(url, null);
if(!releaseResult.success()) {
result.setErrorCode(releaseResult.getCode());
result.setErrorMsg(releaseResult.getMsg());
return result;
}
JSONObject jsonObject = JSONObject.parseObject(releaseResult.getData());
result.setErrorCode(jsonObject.getInteger(ERR_CODE));
result.setErrorMsg(jsonObject.getString(ERR_MSG));
return result;
}
@Override
public WxResult undoCodeAudit(String accessToken) {
WxResult result = new WxResult();
String url = WxMaCodeConstant.UNDO_CODE_AUDIT_URL + "?" + "access_token=" + accessToken;
Result<String> undoResult = HttpClientManager.getInstance().sendGet(url, null);
if(!undoResult.success()) {
result.setErrorCode(undoResult.getCode());
result.setErrorMsg(undoResult.getMsg());
return result;
}
JSONObject jsonObject = JSONObject.parseObject(undoResult.getData());
result.setErrorCode(jsonObject.getInteger(ERR_CODE));
result.setErrorMsg(jsonObject.getString(ERR_MSG));
return result;
}
public static void main(String[] args) {
String url = "{\"errcode\":0,\"errmsg\":\"ok\",\"category_list\":[{\"first_class\":\"工具\",\"second_class\":\"备忘录\",\"first_id\":1,\"second_id\":2,}\n" +
"{\"first_class\":\"教育\",\"second_class\":\"学历教育\",\"third_class\":\"高等\",\"first_id\":3,\"second_id\":4,\"third_id\":5,}]}";
WxMaGetCategoryResult video = JSONObject.parseObject(url, WxMaGetCategoryResult.class);
WxResult<List<WxMaCategoryResult>> result = new WxResult<>();
result.setErrorCode(video.getErrcode());
result.setErrorMsg(video.getErrmsg());
result.setData(video.getCategoryList());
System.out.println(result);
WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest();
request.setVersionDesc("aasdf");
}
private String toJson(Object object) {
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();
Gson gson = gsonBuilder.create();
return gson.toJson(object);
}
}
}

22
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeAuditResultDao.xml

@ -0,0 +1,22 @@
<?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.CodeAuditResultDao">
<resultMap type="com.epmet.entity.CodeAuditResultEntity" id="codeAuditResultMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="codeId" column="CODE_ID"/>
<result property="auditId" column="AUDIT_ID"/>
<result property="result" column="RESULT"/>
<result property="reason" column="REASON"/>
<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>

27
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml

@ -0,0 +1,27 @@
<?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.CodeCustomerDao">
<resultMap type="com.epmet.entity.CodeCustomerEntity" id="codeCustomerMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="customerName" column="CUSTOMER_NAME"/>
<result property="accessTokenId" column="ACCESS_TOKEN_ID"/>
<result property="templateId" column="TEMPLATE_ID"/>
<result property="type" column="TYPE"/>
<result property="appId" column="APP_ID"/>
<result property="extJson" column="EXT_JSON"/>
<result property="userVersion" column="USER_VERSION"/>
<result property="userDesc" column="USER_DESC"/>
<result property="status" column="STATUS"/>
<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>

21
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeMediaDao.xml

@ -0,0 +1,21 @@
<?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.CodeMediaDao">
<resultMap type="com.epmet.entity.CodeMediaEntity" id="codeMediaMap">
<result property="id" column="ID"/>
<result property="codeId" column="CODE_ID"/>
<result property="mediaId" column="MEDIA_ID"/>
<result property="mediaName" column="MEDIA_NAME"/>
<result property="mediaType" column="MEDIA_TYPE"/>
<result property="revision" column="REVISION"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

22
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerCodeOperationHistoryDao.xml

@ -0,0 +1,22 @@
<?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.CustomerCodeOperationHistoryDao">
<resultMap type="com.epmet.entity.CustomerCodeOperationHistoryEntity" id="customerCodeOperationHistoryMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="codeId" column="CODE_ID"/>
<result property="version" column="VERSION"/>
<result property="operation" column="OPERATION"/>
<result property="describe" column="DESCRIBE"/>
<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>

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

@ -3,5 +3,20 @@
<mapper namespace="com.epmet.dao.CustomerMpDao">
<select id="selectByCustomerId" resultType="com.epmet.dto.CustomerMpDTO">
SELECT
id,
customer_id,
client,
app_id,
authorization_flag
FROM
customer_mp
WHERE
del_flag = '0'
AND customer_id = #{customerId}
ORDER BY
client ASC
</select>
</mapper>

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

@ -15,4 +15,22 @@
AND pcua.user_id = #{userId}
</select>
<select id="selectCustomerAgency" resultType="com.epmet.dto.PaCustomerAgencyDTO">
SELECT
id,
customer_id,
agency_name,
`level`,
area_code,
province,
city,
district,
partybranchnum
FROM
pa_customer_agency
WHERE del_flag = '0'
AND customer_id = #{customerId}
LIMIT 1
</select>
</mapper>

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

@ -3,5 +3,17 @@
<mapper namespace="com.epmet.dao.PaCustomerDao">
<select id="selectCustomerByUserId" resultType="com.epmet.dto.PaCustomerDTO">
SELECT
pc.id,
pc.customer_name
FROM
pa_customer pc
INNER JOIN pa_customer_user_agency pcua ON pc.id = pcua.customer_id
WHERE
pc.del_flag = '0'
AND pcua.del_flag = '0'
AND pcua.user_id = #{userId}
</select>
</mapper>

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

@ -3,5 +3,17 @@
<mapper namespace="com.epmet.dao.PaUserDao">
<select id="selectUserByPhone" resultType="com.epmet.dto.PaUserDTO">
SELECT
id,
phone,
real_name,
gender
FROM
pa_user
WHERE
del_flag = '0'
AND phone = #{phone}
</select>
</mapper>

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

Loading…
Cancel
Save