Browse Source

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

master
wangchao 5 years ago
parent
commit
5e258b03f1
  1. 2
      epmet-auth/deploy/docker-compose-dev.yml
  2. 2
      epmet-auth/pom.xml
  3. 31
      epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java
  4. 48
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgsFormDTO.java
  5. 20
      epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java
  6. 189
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  7. 9
      epmet-commons/epmet-commons-tools/pom.xml
  8. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  9. 80
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java
  10. 23
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  11. 27
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java
  12. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java
  13. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java
  14. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java
  15. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java
  16. 2
      epmet-module/epmet-heart/epmet-heart-server/deploy/docker-compose-dev.yml
  17. 2
      epmet-module/epmet-heart/epmet-heart-server/pom.xml
  18. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  19. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java
  20. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java
  21. 52
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  22. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java
  23. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  24. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java
  25. 38
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  26. 37
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
  27. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/epmet_heart.sql
  28. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  29. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml
  30. 2
      epmet-module/epmet-third/epmet-third-server/pom.xml
  31. 3
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java
  32. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/CodeCustomerService.java
  33. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java
  34. 104
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
  35. 34
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java
  36. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java
  37. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java
  38. 25
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java
  39. 2
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml
  40. 3
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml
  41. 11
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  42. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  43. 2
      epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
  44. 2
      epmet-module/gov-org/gov-org-server/pom.xml
  45. 16
      epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.2__addCutomerApp.sql
  46. 25
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ThirdCustomerStaffFormDTO.java
  47. 76
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiUserBaseInfoResultDTO.java
  48. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  49. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  50. 2
      epmet-user/epmet-user-server/deploy/docker-compose-dev.yml
  51. 2
      epmet-user/epmet-user-server/pom.xml
  52. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  53. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java
  54. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
  55. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  56. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java
  57. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  58. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java
  59. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  60. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  61. 12
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  62. 22
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

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

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

2
epmet-auth/pom.xml

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -293,17 +293,18 @@ public class ResiActListController {
return actSignInRecService.actSignIn(tokenDto, formDTO);
}
/**
/*
* 活动报名
*
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRegistrationResultDTO>
* @Author zhangyong
* @Date 16:46 2020-07-23
* @Date 16:26 2020-07-28
**/
@PostMapping("registration")
public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) {
public Result<ResiActRegistrationResultDTO> registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActRegistrationFormDTO.AddUserInternalGroup.class);
return actUserRelationService.registration(tokenDto, formDTO);
}

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

@ -73,7 +73,7 @@ public class WorkActController {
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.work.InProgressActResultDTO>
* @param formDTO
* @author yinzuomei
* @description 进行中活动列表
* @description 进行中-活动列表
* @Date 2020/7/23 21:24
**/
@PostMapping("inprogresslist")

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

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

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

@ -39,6 +39,7 @@ import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActRegistrationFormDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.dto.result.resi.ResiActRegistrationResultDTO;
import com.epmet.entity.ActUserLogEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.entity.HeartUserInfoEntity;
@ -54,10 +55,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 用户活动关系表
@ -197,9 +195,10 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Override
@Transactional(rollbackFor = Exception.class)
public Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) {
public Result<ResiActRegistrationResultDTO> registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
boolean satisfy = false;
ResiActRegistrationResultDTO resultDTO = new ResiActRegistrationResultDTO();
// 查询活动信息
ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId());
// >0 当前用户是志愿者
@ -207,15 +206,35 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
if (actInfoDTO.getVolunteerLimit()){
// 活动只能志愿者参加, 当前用户是否满足条件
satisfy = this.volunteerParticipationAct(volunteerFlag);
if (!satisfy){
logger.info("活动报名失败,请先认证志愿者");
resultDTO.setFlag(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
resultDTO.setTip(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
} else {
// 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件
satisfy = this.resiParticipationAct(formDTO.getUserId());
if (!satisfy){
logger.info("活动报名失败,请完善居民信息");
resultDTO.setFlag(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
resultDTO.setTip(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
}
if (satisfy){
// 开始报名
this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag);
boolean actTimeConflict = this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag);
if (!actTimeConflict){
logger.info("报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。");
resultDTO.setFlag(EpmetErrorCode.ACT_TIME_CONFLICT.getCode());
resultDTO.setTip(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
}
return new Result();
resultDTO.setFlag(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getCode());
resultDTO.setTip(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
/**
@ -228,7 +247,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
* @Author zhangyong
* @Date 15:31 2020-07-24
**/
private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){
private boolean actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){
boolean signUp = true;
Integer auditingNum = actUserLogService.countActTimesOfParticipation(formDTO.getUserId());
if (auditingNum > NumConstant.ZERO){
@ -237,8 +256,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
Integer actTimeFlag = actInfoService.checkActTime(actInfoDTO);
if (actTimeFlag > NumConstant.ZERO){
signUp = false;
logger.info("报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。");
throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode());
return signUp;
}
} else {
// 3.第一次报名
@ -249,7 +267,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
this.insertActUserLog(formDTO);
}
// 5.插入 用户活动关系表
this.insertActUserRelation(formDTO, actInfoDTO);
this.insertActUserRelation(formDTO, actInfoDTO);
return signUp;
}
/**
@ -265,10 +284,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
if (volunteerFlag > NumConstant.ZERO){
satisfy = true;
return satisfy;
} else {
logger.info("活动报名失败,请先认证志愿者");
throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
}
return satisfy;
}
/**
@ -289,12 +306,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
}
}
}
if (!satisfy){
logger.info("活动报名失败,请完善居民信息");
throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
} else {
return satisfy;
}
return satisfy;
}
/**

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

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

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

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

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

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

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

@ -3,7 +3,6 @@ package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.MqConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
@ -534,28 +533,41 @@ public class WorkActServiceImpl implements WorkActService {
// 活动状态:报名中:signing_up;截止报名: end_sign_up; 已开始: in_progress; 已报满: enough
if (nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == -1
|| nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == 0) {
logger.info(String.format("当前时间%s报名截止时间%s处于报名中",
DateUtils.format(nowDate,DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getSignUpEndTime(),DateUtils.DATE_TIME_PATTERN)));
//截止报名时间之前(包含报名时间截止时间点)
if (!inProgressActResultDTO.getActQuotaCategory()) {
//如果是不限制名额,则显示报名中
inProgressActResultDTO.setStatus("signing_up");
logger.info("活动不限制名额,界面显示 报名中");
continue;
} else {
//固定名额,且已报名人数<活动需要人数显示报名中
if (inProgressActResultDTO.getActQuota() > inProgressActResultDTO.getSignedUp()) {
logger.info("活动限制名额,未报满,界面显示报名中");
inProgressActResultDTO.setStatus("signing_up");
continue;
} else if (inProgressActResultDTO.getActQuota().equals(inProgressActResultDTO.getSignedUp())) {
inProgressActResultDTO.setStatus("enough");
logger.info("活动限制名额,且已报满,界面显示已报满");
continue;
}
}
} else if (nowDate.compareTo(inProgressActResultDTO.getSignUpEndTime()) == 1
|| nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == -1) {
&&nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == -1) {
logger.info(String.format("当前时间%s报名截止时间%s活动预计开始时间%s界面显示截止报名",
DateUtils.format(nowDate,DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getSignUpEndTime(),DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getActStartTime(),DateUtils.DATE_TIME_PATTERN)));
//活动报名截止-活动预计开始之间显示截止报名
inProgressActResultDTO.setStatus("end_sign_up");
continue;
} else if (nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == 1
|| nowDate.compareTo(inProgressActResultDTO.getActStartTime()) == 0) {
logger.info(String.format("当前时间%s活动预计开始时间%s界面显示已开始",
DateUtils.format(nowDate,DateUtils.DATE_TIME_PATTERN),
DateUtils.format(inProgressActResultDTO.getActStartTime(),DateUtils.DATE_TIME_PATTERN)));
//活动预计开始时间点之后,包含活动预计开始时间点,显示 已开始
inProgressActResultDTO.setStatus("in_progress");
continue;
@ -596,6 +608,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/26 17:26
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void cancelAct(CancelActFormDTO formDTO) {
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
if(null==actInfoDTO){
@ -671,14 +684,15 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/26 19:49
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveActualTime(SaveActualTimeFormDTO formDTO) {
if(formDTO.getActualStartTime().compareTo(formDTO.getActualEndTime())!=-1){
Date actualStartTime= DateUtils.minStrToSecondDate(formDTO.getActualStartTime());
Date actualEndTime= DateUtils.minStrToSecondDate(formDTO.getActualEndTime());
if(actualStartTime.compareTo(actualEndTime)!=-1){
throw new RenException(EpmetErrorCode.ACT_ACTUAL_START_TIME_ERROR.getCode());
}
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
Date actualStartTime= DateUtils.minStrToSecondDate(formDTO.getActualStartTime());
actInfoDTO.setActualStartTime(actualStartTime);
Date actualEndTime= DateUtils.minStrToSecondDate(formDTO.getActualEndTime());
actInfoDTO.setActualEndTime(actualEndTime);
actInfoDTO.setServiceMin(DateUtils.calculateMin(actualStartTime,actualEndTime));
actInfoService.update(actInfoDTO);
@ -736,6 +750,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/26 21:48
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void finishAct(String actId) {
ActInfoDTO actInfoDTO=actInfoService.get(actId);
if(null==actInfoDTO){
@ -762,7 +777,7 @@ public class WorkActServiceImpl implements WorkActService {
private void grantActPoints(ActInfoDTO actInfoDTO) {
//查询已经给分的用户
QueryWrapper<ActUserRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(actInfoDTO.getId()), FieldConstant.ID, actInfoDTO.getId())
wrapper.eq(StringUtils.isNotBlank(actInfoDTO.getId()), "ACT_ID", actInfoDTO.getId())
.eq("PROCESS_FLAG",ActConstant.HANDLED)
.eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE);
List<ActUserRelationEntity> actUserRelationEntityList=actUserRelationDao.selectList(wrapper);
@ -862,10 +877,13 @@ public class WorkActServiceImpl implements WorkActService {
if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode());
}
//如果活动设置的分支大于0,需要判断是否已经处理完毕
//待处理事项为空时才可以结束活动
List<ActUserRelationDTO> list=actUserRelationDao.selectInProgress(actInfoDTO.getId());
if(null!=list&&list.size()>0){
throw new RenException(EpmetErrorCode.HAVE_HANDLE.getCode());
if(actInfoDTO.getReward()>0){
List<ActUserRelationDTO> list=actUserRelationDao.selectInProgress(actInfoDTO.getId());
if(null!=list&&list.size()>0){
throw new RenException(EpmetErrorCode.HAVE_HANDLE.getCode());
}
}
//先填写实际开始时间、实际结束时间
if(null==actInfoDTO.getActualStartTime()||null==actInfoDTO.getActualEndTime()){
@ -882,6 +900,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/27 10:45
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void summaryAct(SummaryActFormDTO formDTO) {
ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId());
if(null==actInfoDTO){
@ -958,6 +977,7 @@ public class WorkActServiceImpl implements WorkActService {
* @Date 2020/7/27 13:55
**/
@Override
@Transactional(rollbackFor = Exception.class)
public PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO) {
ActInfoDTO originalActInfo=actInfoService.get(rePublishFormDTO.getActId());
if(null==originalActInfo){

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

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

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

@ -11,7 +11,7 @@
Target Server Version : 50728
File Encoding : 65001
Date: 28/07/2020 13:38:27
Date: 28/07/2020 15:17:47
*/
SET NAMES utf8mb4;
@ -175,7 +175,6 @@ CREATE TABLE `act_point_log` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键(给分或者不给分,以及重新处理插入本表)',
`ACT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动id',
`USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户id',
`POINT_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '加积分:add ; 减积分:subtract',
`POINTS` int(11) NOT NULL COMMENT '积分值',
`OPERATE_TYPE` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作类型:\r\n同意给分agree; 不给分:deny;重新处理: reset',
`REMARK` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注:拒绝给分和重新处理时录入的理由',

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

@ -483,7 +483,8 @@
AND ( aur.`STATUS` = 'auditing' OR aur.`STATUS` = 'passed' )
) AS signedUp,
ai.SIGN_UP_END_TIME as signUpEndTime,
ai.SIGN_UP_START_TIME as signUpStartTime
ai.SIGN_UP_START_TIME as signUpStartTime,
ai.ACT_ADDRESS as actAddress
FROM
act_info ai
WHERE
@ -502,7 +503,8 @@
ai.ACT_START_TIME AS actStartTime,
ai.ACT_END_TIME AS actEndTime,
ai.CANCEL_TIME AS cancelTime,
ai.CANCEL_REASON AS cancelReason
ai.CANCEL_REASON AS cancelReason,
ai.ACT_ADDRESS as actAddress
FROM
act_info ai
WHERE
@ -522,7 +524,8 @@
ai.ACT_START_TIME AS actStartTime,
ai.ACT_END_TIME AS actEndTime,
ai.ACTUAL_START_TIME as actualStartTime,
ai.ACTUAL_END_TIME as actualEndTime
ai.ACTUAL_END_TIME as actualEndTime,
ai.ACT_ADDRESS as actAddress
FROM
act_info ai
WHERE
@ -539,7 +542,7 @@
aur.id as actUserRelationId,
aur.ACT_ID ,
aur.USER_ID ,
aur.SIGN_IN_FLAG,
aur.SIGN_IN_FLAG as signInFlagStr,
aur.CREATED_TIME as signUpTime,
ai.REWARD,
aur.REWARD_FLAG,

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

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

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

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

3
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/CodeConstant.java

@ -49,6 +49,9 @@ public interface CodeConstant {
String OPER_UPLOAD = "上传代码";
String OPER_SUBMIT = "提交审核";
String OPER_SUCCESS = "审核成功";
String OPER_FAILED = "审核被拒绝";
String OPER_DELAY = "审核延后";
String OPER_UNDO = "审核撤回";
String OPER_RELEASE = "发布";
}

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

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

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

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

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

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

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

@ -241,23 +241,25 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData();
log.info(String.format(POST_RESULT,post));
Map hashMap = JSON.parseObject(post, Map.class);
preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString();
Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN);
Date expiresInTime = this.countExpirationTime(expiresIn.toString());
if (StringUtils.isNotEmpty(preAuthCode)) {
//预授权码 存DB
PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO();
formDTO.setPreAuthToken(preAuthCode);
formDTO.setExpiresInTime(expiresInTime);
//先逻辑删除,在插入DB
preAuthTokenDao.updateOldPreAuthCode();
preAuthTokenDao.insertPreAuthToken(formDTO);
//预授权码 放入缓存
redisThird.setPreAuthCode(preAuthCode);
} else {
throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE);
if (!hashMap.containsKey(ModuleConstant.ERR_MSG)) {
preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString();
Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN);
Date expiresInTime = this.countExpirationTime(expiresIn.toString());
if (StringUtils.isNotEmpty(preAuthCode)) {
//预授权码 存DB
PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO();
formDTO.setPreAuthToken(preAuthCode);
formDTO.setExpiresInTime(expiresInTime);
//先逻辑删除,在插入DB
preAuthTokenDao.updateOldPreAuthCode();
preAuthTokenDao.insertPreAuthToken(formDTO);
//预授权码 放入缓存
redisThird.setPreAuthCode(preAuthCode);
} else {
throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE);
}
log.info(END_GET_PRE_AUTH_CODE);
}
log.info(END_GET_PRE_AUTH_CODE);
return preAuthCode;
}

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

@ -159,10 +159,10 @@ public interface WxMaCodeConstant {
/**
* 新增临时素材
*/
String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/wxa/setwebviewdomain";
String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload";
/**
* 新增临时素材
* 获取模板列表
*/
String GET_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/gettemplatelist";

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

@ -110,7 +110,7 @@ public interface WxMaCodeService {
* @author zhaoqifeng
* @date 2020/7/16 14:52
*/
WxResult<WxMaNewsResult> getMaterial(String accessToken, WxMaNewsReq request);
WxResult<byte[]> getMaterial(String accessToken, WxMaNewsReq request);
/**
* 设置服务器郁闷

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

@ -10,6 +10,7 @@ import com.epmet.wxapi.result.*;
import com.epmet.wxapi.service.WxMaCodeService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -19,7 +20,9 @@ import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 描述一下
@ -156,7 +159,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
return result;
}
WxMaAuditStatusResult auditStatusResult = JSONObject.parseObject(statusResult.getData(), WxMaAuditStatusResult.class);
if (!auditStatusResult.success()){
if (!auditStatusResult.success()) {
result.setErrorCode(auditStatusResult.getErrcode());
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(auditStatusResult.getErrcode()));
return result;
@ -198,19 +201,16 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
}
@Override
public WxResult<WxMaNewsResult> getMaterial(String accessToken, WxMaNewsReq request) {
WxResult<WxMaNewsResult> result = new WxResult<>();
public WxResult<byte[]> getMaterial(String accessToken, WxMaNewsReq request) {
WxResult<byte[]> result = new WxResult<>();
String url = WxMaCodeConstant.GET_MATERIAL_URL + "?" + "access_token=" + accessToken;
Result<String> statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request));
Result<byte[]> statusResult = HttpClientManager.getInstance().getByteArray(url, toMap(request));
if (!statusResult.success()) {
result.setErrorCode(statusResult.getCode());
result.setErrorMsg(statusResult.getMsg());
return result;
}
Gson gson = new Gson();
InputStream inputStream = gson.fromJson(statusResult.getData(), InputStream.class);
WxMaNewsResult newsResult = gson.fromJson(statusResult.getData(), WxMaNewsResult.class);
result.ok(newsResult);
result.ok(statusResult.getData());
return result;
}
@ -269,6 +269,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
WxMaUploadMediaResult mediaInfo = gson.fromJson(mediaResult.getData(), WxMaUploadMediaResult.class);
result.setErrorCode(mediaInfo.getErrCode());
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(mediaInfo.getErrCode()));
result.ok(mediaInfo);
return result;
}
@ -278,4 +279,12 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
Gson gson = gsonBuilder.create();
return gson.toJson(object);
}
private Map<String, Object> toMap(Object object) {
Gson gson = new Gson();
if(object == null){
return Collections.emptyMap();
}
return gson.fromJson(toJson(object), new TypeToken<Map<String, Object>>() {}.getType());
}
}

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

@ -28,7 +28,7 @@
DATE_FORMAT(coh.CREATED_TIME, '%Y-%m-%d %T') AS "operationTime",
coh.VERSION,
coh.OPERATION,
coh.`DESCRIPTION`
coh.`DESCRIPTION` AS "describe"
FROM code_operation_history coh
INNER JOIN code_customer cc ON coh.CODE_ID = cc.ID
WHERE

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

@ -96,6 +96,9 @@
WHERE
del_flag = '0'
AND app_id = #{appId}
AND AUTHORIZATION_FLAG = '1'<!-- 必须是已经完成授权的 -->
ORDER BY CREATED_TIME DESC
LIMIT 1
</select>
<select id="selectCustomerByAppId" resultType="com.epmet.dto.PaCustomerDTO">

11
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -7,6 +7,7 @@ import com.epmet.dto.CustomerPartyBranchDTO;
import com.epmet.dto.form.AddAgencyAndStaffFormDTO;
import com.epmet.dto.form.BelongGridNameFormDTO;
import com.epmet.dto.form.ListPartyBranchFormDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
@ -176,4 +177,14 @@ public interface GovOrgOpenFeignClient {
*/
@PostMapping("/gov/org/customergrid/getgridnamebygridid")
Result<BelongGridNameResultDTO> getGridNameByGridId(@RequestBody BelongGridNameFormDTO formDTO);
/**
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.StaffOrgsResultDTO>>
* @param staffOrgFormDTO
* @Author yinzuomei
* @Description 获取客户对应的根级组织名称
* @Date 2020/4/20 21:37
**/
@PostMapping(value = "/gov/org/customeragency/getStaffOrgList",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<StaffOrgsResultDTO>> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO);
}

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -8,6 +8,7 @@ import com.epmet.dto.CustomerPartyBranchDTO;
import com.epmet.dto.form.AddAgencyAndStaffFormDTO;
import com.epmet.dto.form.BelongGridNameFormDTO;
import com.epmet.dto.form.ListPartyBranchFormDTO;
import com.epmet.dto.form.StaffOrgFormDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.GovOrgOpenFeignClient;
import org.springframework.stereotype.Component;
@ -108,4 +109,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<BelongGridNameResultDTO> getGridNameByGridId(BelongGridNameFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridNameByGridId", formDTO);
}
@Override
public Result<List<StaffOrgsResultDTO>> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffOrgList", staffOrgFormDTO);
}
}

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

@ -2,7 +2,7 @@ version: "3.7"
services:
gov-org-server:
container_name: gov-org-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.76
image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.77
ports:
- "8092:8092"
network_mode: host # 使用现有网络

2
epmet-module/gov-org/gov-org-server/pom.xml

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

16
epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.2__addCutomerApp.sql

@ -0,0 +1,16 @@
CREATE TABLE `customer_app` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id',
`APP_ID` varchar(128) NOT NULL COMMENT '小程序的appId',
`CLIENT` varchar(32) NOT NULL COMMENT 'resi,work',
`SECRET` varchar(255) DEFAULT NULL COMMENT 'app的secret',
`ENABLE_FLAG` int(1) NOT NULL DEFAULT '0' COMMENT '0:停用,1:启用',
`DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
UNIQUE KEY `unx_app_id` (`APP_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='客户app表';

25
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ThirdCustomerStaffFormDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 根据客户ID手机号查询政府端工作人员基本信息
* @Author sun
*/
@Data
public class ThirdCustomerStaffFormDTO implements Serializable{
private static final long serialVersionUID = -7994579456530273809L;
/**
* 客户Id
* */
private String customerId;
/**
* 手机号
* */
private String mobile;
}

76
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiUserBaseInfoResultDTO.java

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

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

@ -220,4 +220,13 @@ public interface EpmetUserOpenFeignClient {
**/
@PostMapping("/epmetuser/customerstaff/staffmsg")
Result<StaffEtAgencyResultDTO> staffMsg(@RequestBody IssueInitiatorFormDTO userId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据客户ID手机号查询政府端工作人员基本信息校验用户是否存在
**/
@GetMapping(value = "epmetuser/customerstaff/getCustsomerStaffByIdAndPhone")
Result<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO);
}

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

@ -162,4 +162,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<StaffEtAgencyResultDTO> staffMsg(IssueInitiatorFormDTO userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "staffMsg", userId);
}
@Override
public Result<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByIdAndPhone", formDTO);
}
}

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

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

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

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

11
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -310,4 +310,15 @@ public class CustomerStaffController {
ValidatorUtils.validateEntity(userId, IssueInitiatorFormDTO.UserIdGroup.class);
return new Result<StaffEtAgencyResultDTO>().ok(customerStaffService.getStaffMsg(userId));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据客户ID手机号查询政府端工作人员基本信息校验用户是否存在
**/
@GetMapping(value = "getCustsomerStaffByIdAndPhone")
public Result<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO) {
return new Result<List<CustomerStaffDTO>>().ok(customerStaffService.getCustsomerStaffByIdAndPhone(formDTO));
}
}

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

@ -17,7 +17,9 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -28,6 +30,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.UserBaseInfoEntity;
import com.epmet.excel.UserBaseInfoExcel;
@ -50,7 +53,7 @@ import java.util.Map;
@RestController
@RequestMapping("userbaseinfo")
public class UserBaseInfoController {
@Autowired
private UserBaseInfoService userBaseInfoService;
@ -146,4 +149,17 @@ public class UserBaseInfoController {
public Result<CustomerUserDetailResultDTO> customerUserDetail(@RequestBody IssueInitiatorFormDTO param){
return new Result<CustomerUserDetailResultDTO>().ok(userBaseInfoService.customerUserDetail(param.getUserId()));
}
/**
* 获取用户基础信息
*
* @param tokenDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.ResiUserBaseInfoResultDTO>
* @Author zhangyong
* @Date 15:20 2020-07-28
**/
@PostMapping("selecuserbaseinfo")
public Result<ResiUserBaseInfoResultDTO> selecUserBaseInfo(@LoginUser TokenDto tokenDTO){
return userBaseInfoService.selecUserBaseInfoByUserId(tokenDTO.getUserId());
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java

@ -139,7 +139,7 @@ public class UserController {
* @Date 14:51 2020-07-23
**/
@PostMapping("updateUserBaseAndWxUserInfo")
public Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) { ;
public Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) {
ValidatorUtils.validateEntity(wxUserInfoFormDTO);
return userService.updateWxUserInfo(wxUserInfoFormDTO);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -140,4 +140,12 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Description 根据staffId查询工作人员基本信息
**/
CustomerStaffDTO selectByStaffId(@Param("staffId") String staffId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据客户ID手机号查询政府端工作人员基本信息
**/
List<CustomerStaffDTO> selectStaff(ThirdCustomerStaffFormDTO formDTO);
}

15
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java

@ -18,10 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserWechatResultDTO;
import com.epmet.entity.UserBaseInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 用户基础信息
@ -49,4 +52,14 @@ public interface UserBaseInfoDao extends BaseDao<UserBaseInfoEntity> {
* @Date 2020/7/22 9:46
**/
UserWechatResultDTO selectUserWechatByUserId(String userId);
}
/**
* 获取用户基础信息
*
* @param userId
* @return com.epmet.dto.result.ResiUserBaseInfoResultDTO
* @Author zhangyong
* @Date 15:20 2020-07-28
**/
ResiUserBaseInfoResultDTO selecUserBaseInfoByUserId(@Param("userId") String userId);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -250,4 +250,12 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @date 2020.07.27 14:45
**/
StaffEtAgencyResultDTO getStaffMsg(IssueInitiatorFormDTO userId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据客户ID手机号查询政府端工作人员基本信息校验用户是否存在
**/
List<CustomerStaffDTO> getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO);
}

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

@ -19,8 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.UserBaseInfoEntity;
@ -130,4 +132,14 @@ public interface UserBaseInfoService extends BaseService<UserBaseInfoEntity> {
* @date 2020.07.27 01:34
**/
CustomerUserDetailResultDTO customerUserDetail(String userId);
}
/**
* 获取用户基础信息
*
* @param userId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.ResiUserBaseInfoResultDTO>
* @Author zhangyong
* @Date 15:20 2020-07-28
**/
Result<ResiUserBaseInfoResultDTO> selecUserBaseInfoByUserId(String userId);
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -25,6 +25,7 @@ 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.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -518,4 +519,23 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return result;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据客户ID手机号查询政府端工作人员基本信息校验用户是否存在
**/
@Override
public List<CustomerStaffDTO> getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO) {
//根据客户Id和手机号查询工作人员信息
List<CustomerStaffDTO> customerStaffDTOList = baseDao.selectStaff(formDTO);
if (null == customerStaffDTOList || customerStaffDTOList.size() < NumConstant.ONE) {
logger.error(String.format("根据客户Id和手机号查询用户异常,客户Id:[%s],手机号:[%s],code[%s],msg[%s]",
formDTO.getCustomerId(), formDTO.getMobile(), EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(),
EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg()));
throw new RenException(EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode());
}
return customerStaffDTOList;
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.UserBaseInfoEntity;
import com.epmet.redis.UserBaseInfoRedis;
@ -254,5 +255,8 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
return null;
}
}
@Override
public Result<ResiUserBaseInfoResultDTO> selecUserBaseInfoByUserId(String userId) {
return new Result<ResiUserBaseInfoResultDTO>().ok(baseDao.selecUserBaseInfoByUserId(userId));
}
}

12
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -203,4 +203,16 @@
del_flag = '0'
AND user_id = #{staffId}
</select>
<select id="selectStaff" resultType="com.epmet.dto.CustomerStaffDTO">
SELECT
*
FROM
customer_staff
WHERE
del_flag='0'
AND customer_id = #{customerId}
AND mobile = #{mobile}
ORDER BY active_time DESC, created_time ASC
</select>
</mapper>

22
epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

@ -68,4 +68,24 @@
uw.DEL_FLAG = '0'
AND uw.USER_ID = #{userId}
</select>
</mapper>
<!-- 根据用户id,查询用户基础信息-->
<select id="selecUserBaseInfoByUserId" resultType="com.epmet.dto.result.ResiUserBaseInfoResultDTO">
SELECT
USER_ID userId,
SURNAME surname,
`NAME` `name`,
REAL_NAME realName,
ID_NUM idNum,
GENDER gender,
MOBILE mobile,
STREET street,
DISTRICT district,
BUILDING_ADDRESS buildingAddress,
NICKNAME nickname,
HEAD_IMG_URL headImgUrl
FROM user_base_info
WHERE DEL_FLAG = '0'
AND USER_ID = #{userId}
</select>
</mapper>

Loading…
Cancel
Save