Browse Source

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

dev_shibei_match
yinzuomei 5 years ago
parent
commit
aa8f99359c
  1. 2
      epmet-auth/deploy/docker-compose-dev.yml
  2. 2
      epmet-auth/pom.xml
  3. 14
      epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java
  4. 9
      epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java
  5. 5
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  6. 40
      epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java
  7. 41
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java
  8. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java
  9. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java
  10. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java
  11. 23
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  12. 59
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java
  13. 2
      epmet-gateway/deploy/docker-compose-prod.yml
  14. 2
      epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml
  15. 2
      epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml
  16. 2
      epmet-module/data-statistical/data-statistical-server/pom.xml
  17. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java
  18. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java
  19. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  20. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  21. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java
  22. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java
  23. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java
  24. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java
  25. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java
  26. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java
  27. 129
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java
  28. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java
  29. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java
  30. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  31. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java
  32. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java
  33. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  34. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java
  35. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java
  36. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java
  37. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java
  38. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java
  39. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java
  40. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java
  41. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java
  42. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml
  43. 20
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml
  44. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  45. 25
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml
  46. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml
  47. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml
  48. 17
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml
  49. 17
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml
  50. 112
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java
  51. 10
      epmet-module/epmet-common-service/common-service-server/pom.xml
  52. 20
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java
  53. 6
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java
  54. 25
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java
  55. 8
      epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml
  56. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java
  57. 60
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  58. 37
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  59. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java
  60. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java
  61. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java
  62. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java
  63. 44
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java
  64. 58
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java
  65. 95
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  66. 58
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java
  67. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  68. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java
  69. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml
  70. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  71. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml
  72. 35
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml
  73. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml
  74. 3
      epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java
  75. 2
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java
  76. 86
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java
  77. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java
  78. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java
  79. 24
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java
  80. 4
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java
  81. 31
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java
  82. 15
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java
  83. 11
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java
  84. 2
      epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml
  85. 8
      epmet-module/epmet-third/epmet-third-server/pom.xml
  86. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java
  87. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java
  88. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java
  89. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java
  90. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java
  91. 7
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java
  92. 8
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java
  93. 23
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java
  94. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java
  95. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java
  96. 7
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java
  97. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserVisitedDao.java
  98. 4
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaUserWechatDao.java
  99. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java
  100. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java

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

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-auth-server:
container_name: epmet-auth-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.43
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.44
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.43</version>
<version>0.3.44</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId>

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

@ -9,6 +9,7 @@ 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.form.RegisterFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.PublicUserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
@ -70,5 +71,18 @@ public class PublicUserLoginController {
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
@PostMapping(value = "/register")
public Result<UserTokenResultDTO> register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class);
formDTO.setUserId(tokenDTO.getUserId());
return new Result<UserTokenResultDTO>().ok(publicUserLoginService.register(formDTO));
}
}

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

@ -4,6 +4,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.LoginByPhoneFormDTO;
import com.epmet.dto.form.PaWxCodeFormDTO;
import com.epmet.dto.form.PublicSendSmsCodeFormDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
/**
@ -38,4 +39,12 @@ public interface PublicUserLoginService {
**/
UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
UserTokenResultDTO register(RegisterFormDTO formDTO);
}

5
epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java

@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import com.alibaba.fastjson.JSON;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@ -120,10 +121,10 @@ public class LoginServiceImpl implements LoginService {
wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode);
}
} catch (WxErrorException e) {
log.error("->[getMaOpenId]::error[{}]", "解析微信code失败");
log.error("->[getMaOpenId]::error[{}]", "解析微信code失败",e);
}
if (null == wxMaJscode2SessionResult) {
log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s]",app,wxCode));
log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult)));
throw new RenException("解析微信用户信息失败");
} else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) {
log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode));

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

@ -1,8 +1,10 @@
package com.epmet.service.impl;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.DateUtils;
@ -14,10 +16,7 @@ import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PaUserDTO;
import com.epmet.dto.PaUserWechatDTO;
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.dto.result.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetThirdFeignClient;
import com.epmet.jwt.JwtTokenProperties;
@ -33,8 +32,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -242,4 +243,35 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService {
return userTokenResultDTO;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 公众号-手机号注册
**/
@Override
public UserTokenResultDTO register(RegisterFormDTO formDTO) {
//1.调用epmet-third服务,完成信息注册
Result<RegisterResultDTO> result = epmetThirdFeignClient.register(formDTO);
if (!result.success()) {
logger.error("调用epmet_third服务初始化用户信息失败");
throw new RenException(result.getCode());
}
RegisterResultDTO resultDTO = result.getData();
//2.直接生成一个新的token放入缓存中(不管缓存中是否存在旧的token,都重新生成)
//2-1.生成token
String token = this.generateGovWxmpToken(resultDTO.getUserId());
//2-2.token存入redis
String openid = resultDTO.getOpenId();
String unionId = (null == resultDTO.getUnionId() ? "" : resultDTO.getUnionId());
this.saveLatestGovTokenDto("", resultDTO.getUserId(), openid, unionId, token);
//3.返回token
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
}

41
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java

@ -0,0 +1,41 @@
package com.epmet.commons.tools.dto.form.mq;
import lombok.Data;
import java.io.Serializable;
/**
* desc消息网关事件类型dto
*
* @author lyn
* @date 2020/7/24 18:30
*/
@Data
public class EventClassDto implements Serializable {
private static final long serialVersionUID = 6923860669547819790L;
/**
* appId
*/
private String appId;
/**
* 事件类型Id
*/
private Integer id;
/**
* 事件标识
*/
private String eventClass;
/**
* 事件名称
*/
private String eventClassName;
/**
* 0''未删''1''已删
*/
private Integer delFlag;
/**
* 事件计数
*/
private Integer eventCount;
}

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java

@ -3,6 +3,8 @@ package com.epmet.commons.tools.dto.form.mq;
import lombok.Data;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotBlank;
/**
* 消息网关基础信息
*
@ -11,20 +13,23 @@ import org.springframework.stereotype.Component;
**/
@Data
@Component
public class MqBaseMsgDTO extends MqConfigDTO {
public class MqBaseMsgDTO extends MqBaseParamDTO {
private static final long serialVersionUID = 8176470786428432009L;
/**
* mq的事件类型
*/
@NotBlank(message = "事件类型不能为空")
private String eventClass;
/**
* 事件code
*/
@NotBlank(message = "事件标识不能为空")
private String eventTag;
/**
* 消息体
*/
@NotBlank(message = "消息体不能为空")
private String msg;
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java → epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java

@ -11,7 +11,7 @@ import java.io.Serializable;
* @date 2020-07-21 14:33
**/
@Data
public class MqConfigDTO implements Serializable {
public class MqBaseParamDTO implements Serializable {
private String appId;
private String token;
private String requestUrl;

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java

@ -9,6 +9,7 @@ package com.epmet.commons.tools.enums;
**/
public enum MqMethodPathEnum {
SEND_MSG("producerService/producer/sendMsg", "发送消息"),
GET_EVENT_LIST("eventClass/getList", "获取事件类型列表"),
;

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

@ -23,9 +23,10 @@ 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;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
@ -43,6 +44,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
@ -170,11 +172,20 @@ public class HttpClientManager {
try {
HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig);
httppost.addHeader("Content-Type", "application/json; charset=utf-8");
FileBody fileBody = new FileBody(file);
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addPart("media", fileBody).build();
httppost.setEntity(reqEntity);
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);
return execute(httppost,false);
} catch (Exception e) {
log.error("send exception", e);

59
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java

@ -4,14 +4,21 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.config.MqConfig;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.EventClassDto;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult;
import com.epmet.commons.tools.enums.MqMethodPathEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 发送亿联云消息工具类
*
@ -21,7 +28,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
public class SendMqMsgUtils {
private static MqConfig mqStaticConfig;
private static MqConfig mqConfig;
/**
* desc:发送mq消息
@ -29,19 +36,19 @@ public class SendMqMsgUtils {
* @return
*/
public static Result<String> sendMsg(MqBaseMsgDTO msg) {
if (mqStaticConfig == null) {
mqStaticConfig = SpringContextUtils.getBean(MqConfig.class);
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
log.debug("sendMsg param:{}", JSON.toJSONString(msg));
try {
// TODO
//ValidatorUtils.validateEntity(msg, null);
ValidatorUtils.validateEntity(msg, DefaultGroup.class);
} catch (ValidateException e) {
return new Result<String>().error(e.getMsg());
}
msg.setAppId(mqStaticConfig.getAppId());
msg.setRequestUrl(mqStaticConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode()));
msg.setToken(mqStaticConfig.getToken());
msg.setAppId(mqConfig.getAppId());
msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode()));
msg.setToken(mqConfig.getToken());
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg));
log.debug("sendMsg result:{}", JSON.toJSONString(result));
@ -66,4 +73,42 @@ public class SendMqMsgUtils {
}
/**
* desc:发送mq消息
*
* @return
*/
public static Result<List<EventClassDto>> getEventClassList() {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
Map<String, String> param = new HashMap<>();
param.put("appId", mqConfig.getAppId());
param.put("token", mqConfig.getToken());
String requestUrl = mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode());
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(param));
log.debug("getEventClassList result:{}", JSON.toJSONString(result));
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
List<EventClassDto> eventClassDto = JSON.parseArray(resultResult.getData(), EventClassDto.class);
return new Result<List<EventClassDto>>().ok(eventClassDto);
} else {
log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult));
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg());
}
}
Result<List<EventClassDto>> resultResult = new Result<>();
resultResult.error(result.getCode(), result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.debug("sendMsg exception", e);
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
}

2
epmet-gateway/deploy/docker-compose-prod.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-gateway-server:
container_name: epmet-gateway-server-prod
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.25
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.26
ports:
- "8080:8080"
network_mode: host # 使用现有网络

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

@ -2,7 +2,7 @@ version: "3.7"
services:
data-statistical-server:
container_name: data-statistical-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.39
image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.41
ports:
- "8108:8108"
network_mode: host # 使用现有网络

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

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

2
epmet-module/data-statistical/data-statistical-server/pom.xml

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

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java

@ -43,4 +43,6 @@ public interface CustomerDao extends BaseDao<CustomerEntity> {
List<CustomerEntity> listValidCustomersByCreateTime(
@Param("createTimeFrom") Date createTimeFrom,
@Param("createTimeTo") Date createTimeTo);
List<CustomerEntity> listValidCustomersByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java

@ -38,4 +38,5 @@ public interface CustomerDepartmentDao extends BaseDao<CustomerDepartmentEntity>
@Param("createdTimeFrom") Date createdTimeFrom,
@Param("createdTimeTo") Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -59,4 +59,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @author zxc
*/
List<GridIdListByCustomerResultDTO> getCustomerGridIdList(@Param("customerId") String customerId, @Param("dateId") String dateId);
/**
* 根据更新时间查询列表
* @param startTime
* @param endTime
* @return
*/
List<CustomerGridEntity> listUpdatedGridsByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -20,4 +20,6 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<AgencySubTreeDto> selectAllAgency();
List<AgencySubTreeDto> selectSubAgencyByPid(@Param("pid")String pid);
List<CustomerAgencyEntity> listAgenciesByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java

@ -124,4 +124,6 @@ public interface DimAgencyDao extends BaseDao<DimAgencyEntity> {
String getPidByAgencyId(@Param("agencyId") String agencyId);
DimAgencyEntity getLatestCreatedAgencyDimEntity();
DimAgencyEntity getLatestUpdatedAgencyDimEntity();
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java

@ -47,4 +47,6 @@ public interface DimCustomerDao extends BaseDao<DimCustomerEntity> {
void insertOne(DimCustomerEntity dim);
DimCustomerEntity getLatestCreatedDimEntity();
DimCustomerEntity getLatestUpdatedDimEntity();
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java

@ -42,4 +42,6 @@ public interface DimDepartmentDao extends BaseDao<DimDepartmentEntity> {
List<DimDepartmentEntity> getDepartmentListByCustomerId(@Param("customerId") String customerId);
DimDepartmentEntity getLatestCreatedDimEntity();
DimDepartmentEntity getLatestUpdatedDimEntity();
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java

@ -58,4 +58,6 @@ public interface DimGridDao extends BaseDao<DimGridEntity> {
* @author zxc
*/
List<SubAgencyIdResultDTO> selectSubAgencyId(@Param("formDTO")List<AgencyDTO> formDTO);
DimGridEntity getLastUpdatedGridDim();
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java

@ -9,4 +9,5 @@ public interface CustomerService {
List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo);
List<CustomerEntity> listValidCustomersByUpdatedTime(Date updatedTime, Date initTime);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java

@ -22,4 +22,9 @@ public class CustomerServiceImpl implements CustomerService {
public List<CustomerEntity> listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) {
return customerDao.listValidCustomersByCreateTime(createTimeFrom, createTimeTo);
}
@Override
public List<CustomerEntity> listValidCustomersByUpdatedTime(Date startTime, Date endTime) {
return customerDao.listValidCustomersByUpdateTime(startTime, endTime);
}
}

129
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java

@ -1,8 +1,6 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.RobotConstant;
import com.epmet.constant.StatsSubject;
import com.epmet.entity.crm.CustomerEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.entity.org.CustomerDepartmentEntity;
@ -18,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -54,6 +53,17 @@ public class StatsDimServiceImpl implements StatsDimService {
@Override
public void initGridDim() {
List<DimGridEntity> newDimGrids = getNewDimGrids();
List<DimGridEntity> changedGrids = getChangedGrids();
dimGridService.initGridDims(newDimGrids, changedGrids);
}
/**
* 初始化新建网格
* @return
*/
public List<DimGridEntity> getNewDimGrids() {
DimGridEntity lastDimEntity = dimGridService.getLastCreatedGridDim();
List<CustomerGridEntity> grids;
Date now = new Date();
@ -65,10 +75,36 @@ public class StatsDimServiceImpl implements StatsDimService {
grids = customerGridService.listGridsByCreateTime(lastInitTime, now);
}
List<DimGridEntity> gridDims = convertCustomerGrid2GridDim(grids, now);
if (!CollectionUtils.isEmpty(gridDims)) {
dimGridService.initGridDims(gridDims);
return convertCustomerGrid2GridDim(grids, now);
}
/**
* 初始化变更的网格
* @return
*/
public List<DimGridEntity> getChangedGrids() {
DimGridEntity lastUpdatedGridDim = dimGridService.getLastUpdatedGridDim();
List<CustomerGridEntity> updatedGrids;
Date now = new Date();
if (lastUpdatedGridDim != null) {
Date lastInitTime = lastUpdatedGridDim.getUpdatedTime();
updatedGrids = customerGridService.listUpdatedGridsByUpdateTime(lastInitTime, now);
ArrayList<DimGridEntity> dimGrids = new ArrayList<>();
for (CustomerGridEntity updatedGrid : updatedGrids) {
DimGridEntity dimGrid = dimGridService.selectById(updatedGrid.getId());
if (dimGrid != null) {
dimGrid.setGridName(updatedGrid.getGridName());
dimGrid.setUpdatedTime(now);
dimGrid.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
dimGrids.add(dimGrid);
}
}
return dimGrids;
}
return new ArrayList<>();
}
/**
@ -98,19 +134,41 @@ public class StatsDimServiceImpl implements StatsDimService {
*/
@Override
public void initAgencyDim() {
Date now = new Date();
List<CustomerAgencyEntity> agencies2Add = listAgencies2Add(now);
List<CustomerAgencyEntity> agencies2Update = listAgencies2Update(now);
dimAgencyService.initAgencyDims(agencies2Add, agencies2Update, now);
}
/**
* 查询需要添加的机关ç
* @return
*/
public List<CustomerAgencyEntity> listAgencies2Add(Date endDate) {
DimAgencyEntity latestCreatedAgencyDim = dimAgencyService.getLatestCreatedAgencyDimEntity();
Date now = new Date();
Date lastInitTime = null;
if (latestCreatedAgencyDim != null) {
lastInitTime = latestCreatedAgencyDim.getCreatedTime();
}
List<CustomerAgencyEntity> agencies = customerAgencyService.listAgenciesByCreateTime(lastInitTime, now);
if (!CollectionUtils.isEmpty(agencies)) {
dimAgencyService.initAgencyDims(agencies, now);
return customerAgencyService.listAgenciesByCreateTime(lastInitTime, endDate);
}
/**
* 查询需要更新的机关
* @return
*/
public List<CustomerAgencyEntity> listAgencies2Update(Date endDate) {
DimAgencyEntity latestUpdatedAgencyDim = dimAgencyService.getLatestUpdatedAgencyDimEntity();
if (latestUpdatedAgencyDim != null) {
// 不是首次初始化,可以更新
Date updatedTime = latestUpdatedAgencyDim.getUpdatedTime();
return customerAgencyService.listAgenciesByUpdatedTime(updatedTime, endDate);
}
return new ArrayList<>();
}
/**
@ -118,24 +176,59 @@ public class StatsDimServiceImpl implements StatsDimService {
*/
@Override
public void initCustomerDim() {
Date now = new Date();
List<CustomerEntity> newCustomers = listNewCustomers(now);
List<CustomerEntity> updatedCustomers = listUpdatedCustomers(now);
// System.out.println(666);
dimCustomerService.initCustomerDims(newCustomers, updatedCustomers, now);
}
/**
* 查询新增的客户列表
* @param initTime
* @return
*/
public List<CustomerEntity> listNewCustomers(Date initTime) {
DimCustomerEntity lastCreateDim = dimCustomerService.getLatestCreatedDimEntity();
Date now = new Date();
Date lastInitTime = null;
if (lastCreateDim != null) {
lastInitTime = lastCreateDim.getCreatedTime();
}
List<CustomerEntity> customers = customerService.listValidCustomersByCreateTime(lastInitTime, now);
if (!CollectionUtils.isEmpty(customers)) {
dimCustomerService.initCustomerDims(customers, now);
List<CustomerEntity> customers = customerService.listValidCustomersByCreateTime(lastInitTime, initTime);
return customers;
}
/**
* 查询更新的客户列表
* @param initTime
* @return
*/
public List<CustomerEntity> listUpdatedCustomers(Date initTime) {
DimCustomerEntity lastCreatedDim = dimCustomerService.getLatestUpdatedDimEntity();
if (lastCreatedDim != null) {
// 说明不是首次初始化
List<CustomerEntity> customers = customerService.listValidCustomersByUpdatedTime(lastCreatedDim.getUpdatedTime(), initTime);
return customers;
}
return new ArrayList<>();
}
/**
* 初始化部门维度
*/
@Override
public void initDepartmentDim() {
Date now = new Date();
List<CustomerDepartmentEntity> newDepartments = listNewDepartments(now);
List<CustomerDepartmentEntity> updatedDepartments = listUpdatedDepartments(now);
dimDepartmentService.initDepartmentDims(newDepartments, updatedDepartments, now);
}
public List<CustomerDepartmentEntity> listNewDepartments(Date initTime) {
DimDepartmentEntity lastCreatedDeptDim = dimDepartmentService.getLatestCreatedDimEntity();
Date now = new Date();
@ -144,10 +237,14 @@ public class StatsDimServiceImpl implements StatsDimService {
if (lastCreatedDeptDim != null) {
lastInitTime = lastCreatedDeptDim.getCreatedTime();
}
return departmentService.listDepartmentsByCreatedTime(lastInitTime, now);
}
List<CustomerDepartmentEntity> departments = departmentService.listDepartmentsByCreatedTime(lastInitTime, now);
if (!CollectionUtils.isEmpty(departments)) {
dimDepartmentService.initDepartmentDims(departments, now);
public List<CustomerDepartmentEntity> listUpdatedDepartments(Date initTime) {
DimDepartmentEntity lastUpdatedDeptDim = dimDepartmentService.getLatestUpdatedDimEntity();
if (lastUpdatedDeptDim != null) {
return departmentService.listDepartmentsByUpdatedTime(lastUpdatedDeptDim.getCreatedTime(), initTime);
}
return new ArrayList<>();
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -7,4 +7,6 @@ import java.util.List;
public interface CustomerAgencyService {
List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime);
List<CustomerAgencyEntity> listAgenciesByUpdatedTime(Date updatedTime, Date now);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java

@ -8,4 +8,6 @@ import java.util.List;
public interface CustomerDepartmentService {
List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo);
List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date createdTime, Date initTime);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java

@ -32,4 +32,12 @@ public interface CustomerGridService {
* @author zxc
*/
List<GridIdListByCustomerResultDTO> getCustomerGridIdList(String customerId, String dateId);
/**
* 根据更新时间查询变更过的网格列表
* @param lastInitTime
* @param now
* @return
*/
List<CustomerGridEntity> listUpdatedGridsByUpdateTime(Date lastInitTime, Date now);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java

@ -22,4 +22,9 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService {
public List<CustomerAgencyEntity> listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) {
return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime);
}
@Override
public List<CustomerAgencyEntity> listAgenciesByUpdatedTime(Date startTime, Date endTime) {
return customerAgencyDao.listAgenciesByUpdatedTime(startTime, endTime);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java

@ -28,4 +28,9 @@ public class CustomerDepartmentServiceImpl implements CustomerDepartmentService
public List<CustomerDepartmentEntity> listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) {
return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo);
}
@Override
public List<CustomerDepartmentEntity> listDepartmentsByUpdatedTime(Date startTime, Date endTime) {
return departmentDao.listDepartmentsByUpdatedTime(startTime, endTime);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -46,4 +46,9 @@ public class CustomerGridServiceImpl implements CustomerGridService {
public List<GridIdListByCustomerResultDTO> getCustomerGridIdList(String customerId, String dateId) {
return customerGridDao.getCustomerGridIdList(customerId, dateId);
}
@Override
public List<CustomerGridEntity> listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) {
return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java

@ -107,9 +107,8 @@ public interface DimAgencyService extends BaseService<DimAgencyEntity> {
/**
* 初始化机关维度
* @param agencies
*/
void initAgencyDims(List<CustomerAgencyEntity> agencies, Date initTime);
void initAgencyDims(List<CustomerAgencyEntity> agencies2Add, List<CustomerAgencyEntity> agencies2Update, Date initTime);
/**
* @Description 查询所有机关以及它下级机关的信息
@ -175,4 +174,6 @@ public interface DimAgencyService extends BaseService<DimAgencyEntity> {
String getPidByAgencyId(String agencyId);
DimAgencyEntity getLatestCreatedAgencyDimEntity();
DimAgencyEntity getLatestUpdatedAgencyDimEntity();
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java

@ -110,9 +110,10 @@ public interface DimCustomerService extends BaseService<DimCustomerEntity> {
/**
* 添加客户维度
* @param customers
*/
void initCustomerDims(List<CustomerEntity> customers, Date initTime);
void initCustomerDims(List<CustomerEntity> newCustomers, List<CustomerEntity> updatedCustomers, Date initTime);
DimCustomerEntity getLatestCreatedDimEntity();
DimCustomerEntity getLatestUpdatedDimEntity();
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java

@ -95,7 +95,7 @@ public interface DimDepartmentService extends BaseService<DimDepartmentEntity> {
*/
void delete(String[] ids);
void initDepartmentDims(List<CustomerDepartmentEntity> departments, Date initTime);
void initDepartmentDims(List<CustomerDepartmentEntity> newDepartments, List<CustomerDepartmentEntity> updatedDepartments, Date initTime);
/**
* desc: 根据客户Id获取 部门数据
@ -108,4 +108,6 @@ public interface DimDepartmentService extends BaseService<DimDepartmentEntity> {
List<DimDepartmentEntity> getDepartmentListByCustomerId(String customerId);
DimDepartmentEntity getLatestCreatedDimEntity();
DimDepartmentEntity getLatestUpdatedDimEntity();
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java

@ -101,9 +101,8 @@ public interface DimGridService extends BaseService<DimGridEntity> {
/**
* 初始化网格维度
* @param gridDims
*/
void initGridDims(List<DimGridEntity> gridDims);
void initGridDims(List<DimGridEntity> newDimGrids, List<DimGridEntity> changedGrids);
/**
* desc: 根据客户Id获取 该客户下所有的网格数据
@ -128,4 +127,6 @@ public interface DimGridService extends BaseService<DimGridEntity> {
* @author zxc
*/
List<SubAgencyIdResultDTO> selectSubAgencyId(List<AgencyDTO> formDTO);
DimGridEntity getLastUpdatedGridDim();
}

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java

@ -123,12 +123,25 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
@Transactional(rollbackFor = Exception.class)
@Override
public void initAgencyDims(List<CustomerAgencyEntity> agencies, Date initTime) {
for (CustomerAgencyEntity agency : agencies) {
public void initAgencyDims(List<CustomerAgencyEntity> agencies2Add, List<CustomerAgencyEntity> agencies2Update, Date initTime) {
// 添加新增的机关维度
for (CustomerAgencyEntity agency : agencies2Add) {
initAgencyAllDim(agency, initTime);
initAgencySelfDim(agency, initTime);
}
// 更新变更过的机关维度
for (CustomerAgencyEntity agency : agencies2Update) {
DimAgencyEntity existsDimAgency = baseDao.selectById(agency.getId());
if (existsDimAgency != null) {
//说明是已存在的,不是新增的
existsDimAgency.setAgencyName(agency.getOrganizationName());
existsDimAgency.setUpdatedTime(initTime);
existsDimAgency.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
baseDao.updateById(existsDimAgency);
}
}
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY);
}
@ -255,4 +268,9 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
return baseDao.getLatestCreatedAgencyDimEntity();
}
@Override
public DimAgencyEntity getLatestUpdatedAgencyDimEntity() {
return baseDao.getLatestUpdatedAgencyDimEntity();
}
}

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimCustomerServiceImpl.java

@ -120,8 +120,9 @@ public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimC
@Transactional(rollbackFor = Exception.class)
@Override
public void initCustomerDims(List<CustomerEntity> customers, Date initTime) {
for (CustomerEntity customer : customers) {
public void initCustomerDims(List<CustomerEntity> newCustomers, List<CustomerEntity> updatedCustomers, Date initTime) {
// 添加新增的客户维度
for (CustomerEntity customer : newCustomers) {
DimCustomerEntity dim = new DimCustomerEntity();
dim.setCustomerName(customer.getCustomerName());
dim.setCreatedBy(RobotConstant.DIMENSION_ROBOT);
@ -131,6 +132,18 @@ public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimC
dim.setUpdatedTime(initTime);
baseDao.insert(dim);
}
// 更新已存在的客户维度
for (CustomerEntity updatedCustomer : updatedCustomers) {
DimCustomerEntity existsCustomerDim = baseDao.selectById(updatedCustomer.getId());
if (existsCustomerDim != null) {
existsCustomerDim.setCustomerName(updatedCustomer.getCustomerName());
existsCustomerDim.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
existsCustomerDim.setUpdatedTime(initTime);
baseDao.updateById(existsCustomerDim);
}
}
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_CUSTOMER);
}
@ -138,4 +151,9 @@ public class DimCustomerServiceImpl extends BaseServiceImpl<DimCustomerDao, DimC
public DimCustomerEntity getLatestCreatedDimEntity() {
return baseDao.getLatestCreatedDimEntity();
}
@Override
public DimCustomerEntity getLatestUpdatedDimEntity() {
return baseDao.getLatestUpdatedDimEntity();
}
}

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java

@ -109,8 +109,9 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
@Transactional(rollbackFor = Exception.class)
@Override
public void initDepartmentDims(List<CustomerDepartmentEntity> departments, Date initTime) {
for (CustomerDepartmentEntity department : departments) {
public void initDepartmentDims(List<CustomerDepartmentEntity> newDepartments, List<CustomerDepartmentEntity> updatedDepartments, Date initTime) {
// 新增科室初始化
for (CustomerDepartmentEntity department : newDepartments) {
DimDepartmentEntity dim = new DimDepartmentEntity();
dim.setAgencyId(department.getAgencyId());
dim.setCustomerId(department.getCustomerId());
@ -122,6 +123,18 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
dim.setUpdatedTime(initTime);
baseDao.insert(dim);
}
// 修改科室初始化
for (CustomerDepartmentEntity updatedDepartment : updatedDepartments) {
DimDepartmentEntity dimDepartment = baseDao.selectById(updatedDepartment.getId());
if (dimDepartment != null) {
dimDepartment.setDepartmentName(updatedDepartment.getDepartmentName());
dimDepartment.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
dimDepartment.setUpdatedTime(initTime);
baseDao.updateById(dimDepartment);
}
}
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_DEPARTMENT);
}
@ -137,4 +150,9 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl<DimDepartmentDao,
public DimDepartmentEntity getLatestCreatedDimEntity() {
return baseDao.getLatestCreatedDimEntity();
}
@Override
public DimDepartmentEntity getLatestUpdatedDimEntity() {
return baseDao.getLatestUpdatedDimEntity();
}
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java

@ -117,13 +117,16 @@ public class DimGridServiceImpl extends BaseServiceImpl<DimGridDao, DimGridEntit
/**
* 初始化网格维度
* @param gridDims
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void initGridDims(List<DimGridEntity> gridDims) {
for (DimGridEntity gridDim : gridDims) {
baseDao.insert(gridDim);
public void initGridDims(List<DimGridEntity> newDimGrids, List<DimGridEntity> changedGrids) {
for (DimGridEntity newGridDim : newDimGrids) {
baseDao.insert(newGridDim);
}
for (DimGridEntity updatedGridDim : changedGrids) {
baseDao.updateById(updatedGridDim);
}
lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_GRID);
@ -156,4 +159,9 @@ public class DimGridServiceImpl extends BaseServiceImpl<DimGridDao, DimGridEntit
public List<SubAgencyIdResultDTO> selectSubAgencyId(List<AgencyDTO> formDTO) {
return baseDao.selectSubAgencyId(formDTO);
}
@Override
public DimGridEntity getLastUpdatedGridDim() {
return baseDao.getLastUpdatedGridDim();
}
}

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml

@ -41,4 +41,27 @@
CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC
</select>
<select id="listValidCustomersByUpdateTime" resultType="com.epmet.entity.crm.CustomerEntity">
select id,
customer_name,
title,
organization_number,
organization_img,
validity_time,
customer_admin,
customer_password,
organization_levels,
logo,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
organization_level
from customer
where UPDATED_TIME >= #{startTime}
and UPDATED_TIME <![CDATA[<]]> #{endTime}
</select>
</mapper>

20
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml

@ -16,4 +16,24 @@
</if>
</where>
</select>
<select id="listDepartmentsByUpdatedTime" resultType="com.epmet.entity.org.CustomerDepartmentEntity">
select
id,
customer_id,
agency_id,
department_name,
department_duty,
total_user,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from customer_department
where UPDATED_TIME > #{startTime}
and UPDATED_TIME <![CDATA[<=]]> #{endTime}
</select>
</mapper>

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -47,4 +47,25 @@
AND customer_id = #{customerId}
AND DATE_FORMAT( created_time, '%Y%m%d' ) <![CDATA[ <= ]]> #{dateId}
</select>
<select id="listUpdatedGridsByUpdateTime" resultType="com.epmet.entity.org.CustomerGridEntity">
SELECT id,
customer_id,
grid_name,
longitude,
latitude,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
manage_district,
total_user,
pid,
pids
FROM customer_grid
WHERE UPDATED_TIME >= #{startTime}
AND UPDATED_TIME <![CDATA[<]]> #{endTime}
</select>
</mapper>

25
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml

@ -75,4 +75,29 @@
grid.ID
</select>
<select id="listAgenciesByUpdatedTime" resultType="com.epmet.entity.org.CustomerAgencyEntity">
select
id,
customer_id,
pid,
pids,
all_parent_name,
organization_name,
level,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
total_user,
province,
city,
district
from customer_agency
where UPDATED_TIME >= #{startTime}
and UPDATED_TIME <![CDATA[<=]]> #{endTime}
</select>
</mapper>

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml

@ -277,4 +277,25 @@
LIMIT 1
</select>
<!-- 最后一次更新的时间-->
<select id="getLatestUpdatedAgencyDimEntity" resultType="com.epmet.entity.stats.DimAgencyEntity">
select id,
agency_name,
customer_id,
pid,
pids,
all_parent_name,
level,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time,
agency_dim_type
from dim_agency
order by UPDATED_TIME desc
limit 1
</select>
</mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml

@ -25,4 +25,19 @@
ORDER BY CREATED_TIME DESC
LIMIT 1
</select>
<select id="getLatestUpdatedDimEntity" resultType="com.epmet.entity.stats.DimCustomerEntity">
select
id,
customer_name,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from dim_customer
order by UPDATED_TIME desc
limit 1;
</select>
</mapper>

17
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml

@ -35,4 +35,21 @@
ORDER BY CREATED_TIME DESC
LIMIT 1
</select>
<select id="getLatestUpdatedDimEntity" resultType="com.epmet.entity.stats.DimDepartmentEntity">
select
id,
department_name,
agency_id,
customer_id,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from dim_department
order by UPDATED_TIME desc
limit 1
</select>
</mapper>

17
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml

@ -52,4 +52,21 @@
</foreach>
</select>
<select id="getLastUpdatedGridDim" resultType="com.epmet.entity.stats.DimGridEntity">
select id,
grid_name,
customer_id,
agency_id,
area_code,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from dim_grid
order by UPDATED_TIME desc
limit 1;
</select>
</mapper>

112
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java

@ -0,0 +1,112 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 事件表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-16
*/
@Data
public class EventDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 消息网关事件类别ID 从消息网关获取事件类型Id
*/
private String classId;
/**
* 消息网关APP_ID
*/
private String appId;
/**
* 消息网关APP_NAME
*/
private String appName;
/**
* 事件标识 与消息网关事件tag一致
*/
private String eventCode;
/**
* 事件名称
*/
private String eventName;
/**
* 事件说明
*/
private String eventDesc;
/**
* 事件功能分组ID 来自oper_customize.customer_function表
*/
private String functionId;
/**
* 是否是通用事件 0-1-消息体内需要体现该字段通用则说明由业务系统自己计算分值
*/
private String isCommon;
/**
* 删除标识 0-1-
*/
private String delFlag;
/**
* 乐观锁 查询时添加版本号新加的事件需要更新版本号
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

10
epmet-module/epmet-common-service/common-service-server/pom.xml

@ -116,6 +116,11 @@
<nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--亿联云消息网关配置-->
<elink.mq.host>https://epmet-dev.elinkservice.cn/estos/</elink.mq.host>
<elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath>
<elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId>
<elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token>
</properties>
</profile>
<profile>
@ -177,6 +182,11 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--亿联云消息网关配置-->
<elink.mq.host>https://epmet-dev.elinkservice.cn/estos/</elink.mq.host>
<elink.mq.sendMsgPath>producerService/producer/sendMsg</elink.mq.sendMsgPath>
<elink.mq.appId>202007161443499985fa2d397436d10356542134c8f008c48</elink.mq.appId>
<elink.mq.token>52d9d9b0e7d0eb5b8b81c205b579e07c</elink.mq.token>
</properties>
</profile>
</profiles>

20
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java

@ -17,15 +17,22 @@
package com.epmet.controller;
import com.epmet.commons.tools.config.MqConfig;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SendMqMsgUtils;
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.dto.form.EventFormDTO;
import com.epmet.dto.result.EventDTO;
import com.epmet.service.EventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 事件表
@ -33,12 +40,25 @@ import org.springframework.web.bind.annotation.*;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-16
*/
@Slf4j
@RestController
@RequestMapping("event")
public class EventController {
@Autowired
private EventService eventService;
@Autowired
private MqConfig mqConfig;
@GetMapping("page")
public Result<PageData<EventDTO>> page(@RequestParam Map<String, Object> params){
PageData<EventDTO> page = eventService.page(params);
return new Result<PageData<EventDTO>>().ok(page);
}
@GetMapping("geteventclass")
public Result<?> getEventClass(){
return SendMqMsgUtils.getEventClassList();
}
/**
* desc:添加事件如果已存在则不作任何改动直接返回成功

6
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java

@ -18,9 +18,13 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.EventFormDTO;
import com.epmet.dto.result.EventDTO;
import com.epmet.entity.EventEntity;
import java.util.Map;
/**
* 事件表
*
@ -32,4 +36,6 @@ public interface EventService extends BaseService<EventEntity> {
void addEvent(EventFormDTO formDTO);
void updateEvent(EventFormDTO formDTO);
PageData<EventDTO> page(Map<String, Object> params);
}

25
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java

@ -17,15 +17,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.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.EventDao;
import com.epmet.dto.form.EventFormDTO;
import com.epmet.dto.result.EventDTO;
import com.epmet.entity.EventEntity;
import com.epmet.service.EventService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 事件表
*
@ -35,7 +43,14 @@ import org.springframework.stereotype.Service;
@Slf4j
@Service
public class EventServiceImpl extends BaseServiceImpl<EventDao, EventEntity> implements EventService {
@Override
public PageData<EventDTO> page(Map<String, Object> params) {
IPage<EventEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, EventDTO.class);
}
@Override
public void addEvent(EventFormDTO formDTO) {
EventEntity eventEntity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class);
@ -46,4 +61,12 @@ public class EventServiceImpl extends BaseServiceImpl<EventDao, EventEntity> imp
public void updateEvent(EventFormDTO formDTO) {
//baseDao.update(eventEntity);
}
private QueryWrapper<EventEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<EventEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
}

8
epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml

@ -118,3 +118,11 @@ ribbon:
pagehelper:
helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
#亿联云消息网关
elink:
mq:
appId: @elink.mq.appId@ #项目接入亿联云的应用Id
token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
host: @elink.mq.host@ #亿联云消息网关服务地址
sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径

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

@ -90,4 +90,9 @@ public class ResiActInsertLiveFormDTO implements Serializable {
* 用户id
*/
private String userId;
/**
* id
*/
private String id;
}

60
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -1,60 +0,0 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.form.WxUserInfoFormDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack;
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;
import java.util.List;
/**
* 用户模块
*
* @author zhangyong
* @date 2020/7/22 14:51
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class)
public interface EpmetUserFeignClient {
/**
* @param userIds
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.UserBaseInfoResultDTO>>
* @author zhangyong
* @description 传入用户id集合返回用户的基本信息包含微信基本信息
* @Date 2020/7/22 9:30
**/
@PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo")
Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(@RequestBody List<String> userIds);
/**
* 根据用户ID查询用户所属角色: 多种身份
*
* @param userId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.UserRoleResultDTO>>
* @Author zhangyong
* @Date 14:13 2020-07-23
**/
@PostMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(@PathVariable("userId") String userId);
/**
* 同步-居民基础信息用户微信信息
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 14:37 2020-07-23
**/
@PostMapping("epmetuser/user/updateUserBaseAndWxUserInfo")
Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO formDTO);
}

37
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -1,37 +0,0 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.WxUserInfoFormDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zhangyong
* @date 2020/7/22 14:51
*/
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result<List<UserBaseInfoResultDTO>> heartQueryUserBaseInfo(List<String> userIds) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds);
}
@Override
public Result<List<UserRoleResultDTO>> getUserRoleInfoByUserId(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId);
}
@Override
public Result updateUserBaseAndWxUserInfo(WxUserInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateUserBaseAndWxUserInfo", formDTO);
}
}

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java

@ -20,7 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ActLivePicDTO;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.entity.ActLiveRecEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -55,4 +55,14 @@ public interface ActLiveRecDao extends BaseDao<ActLiveRecEntity> {
* @Date 17:04 2020-07-22
**/
List<ActLivePicDTO> selectListActLiveImg(@Param("liveId") List liveIds);
/**
* 插入活动实况表
*
* @param formDTO
* @return void
* @Author zhangyong
* @Date 18:05 2020-07-24
**/
void insertActLiveRec(ResiActInsertLiveFormDTO formDTO);
}

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

@ -18,6 +18,8 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ActSignInRecDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.entity.ActSignInRecEntity;
import org.apache.ibatis.annotations.Mapper;
@ -30,4 +32,13 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ActSignInRecDao extends BaseDao<ActSignInRecEntity> {
/**
* 插入活动签到记录表
*
* @param dto
* @return void
* @Author zhangyong
* @Date 18:05 2020-07-24
**/
void insertActSignInRec(ActSignInRecDTO dto);
}

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

@ -18,19 +18,12 @@
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.commons.tools.utils.Result;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActContentFormDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.dto.result.resi.ResiActLiveRecResultDTO;
import com.epmet.entity.ActLiveRecEntity;
import java.util.List;
import java.util.Map;
/**
* 活动实况记录
*

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

@ -18,16 +18,11 @@
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.commons.tools.utils.Result;
import com.epmet.dto.ActSignInRecDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.entity.ActSignInRecEntity;
import java.util.List;
import java.util.Map;
/**
* 活动签到记录
*

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

@ -23,8 +23,6 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.ActLivePicDao;
import com.epmet.dao.ActLiveRecDao;
import com.epmet.dao.ActUserLogDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActLivePicDTO;
import com.epmet.dto.ActLiveRecDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
@ -32,9 +30,10 @@ import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiActLiveRecResultDTO;
import com.epmet.entity.ActLivePicEntity;
import com.epmet.entity.ActLiveRecEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.ActLiveRecRedis;
import com.epmet.service.ActLiveRecService;
import com.epmet.utils.ValidityVerification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -54,7 +53,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
private ActLiveRecRedis actLiveRecRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private ActLivePicDao actLivePicDao;
@ -70,7 +69,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
liveIds.add(actLive.getId());
}
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds);
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
// 根据活动实况id,查询对应实况的图片集合
List<ActLivePicDTO> actLiveImg = baseDao.selectListActLiveImg(liveIds);
// 数据汇总
@ -99,26 +98,29 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl<ActLiveRecDao, ActLiv
@Transactional(rollbackFor = Exception.class)
public Result<String> inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
// 文本校验
ValidityVerification verification = new ValidityVerification();
verification.textScanVerification(formDTO.getDesc(),"添加实况-文本内容审核失败");
// 图片校验
verification.imgScanVerification(formDTO.getImages(),"添加实况-图片审核失败");
// 存储活动实况记录表
ActLiveRecEntity actLiveRecEntity = new ActLiveRecEntity();
actLiveRecEntity.setActId(formDTO.getActId());
actLiveRecEntity.setUserId(formDTO.getUserId());
actLiveRecEntity.setLongitude(formDTO.getLongitude());
actLiveRecEntity.setLatitude(formDTO.getLatitude());
actLiveRecEntity.setAddress(formDTO.getAddress());
actLiveRecEntity.setDesc(formDTO.getDesc());
baseDao.insert(actLiveRecEntity);
String uuid = UUID.randomUUID().toString().replaceAll("-","");
formDTO.setId(uuid);
baseDao.insertActLiveRec(formDTO);
//存储活动实况图片
List<String> imgList = formDTO.getImages();
for (int i = 0; i < imgList.size(); i++) {
String imgUrl = imgList.get(i);
ActLivePicEntity actLivePicEntity = new ActLivePicEntity();
actLivePicEntity.setLiveId(actLiveRecEntity.getId());
actLivePicEntity.setPicUrl(imgUrl);
actLivePicEntity.setSort(i + NumConstant.ONE);
actLivePicDao.insert(actLivePicEntity);
if (null != imgList){
for (int i = 0; i < imgList.size(); i++) {
String imgUrl = imgList.get(i);
ActLivePicEntity actLivePicEntity = new ActLivePicEntity();
actLivePicEntity.setLiveId(uuid);
actLivePicEntity.setPicUrl(imgUrl);
actLivePicEntity.setSort(i + NumConstant.ONE);
actLivePicDao.insert(actLivePicEntity);
}
}
return new Result<String>().ok(actLiveRecEntity.getId());
return new Result<String>().ok(uuid);
}
}

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

@ -25,22 +25,23 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ActConstant;
import com.epmet.dao.ActSignInPicDao;
import com.epmet.dao.ActSignInRecDao;
import com.epmet.dao.ActUserLogDao;
import com.epmet.dao.ActUserRelationDao;
import com.epmet.dto.ActSignInRecDTO;
import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO;
import com.epmet.dto.form.resi.ResiActSignInFormDTO;
import com.epmet.entity.ActSignInPicEntity;
import com.epmet.entity.ActSignInRecEntity;
import com.epmet.entity.ActUserLogEntity;
import com.epmet.redis.ActSignInRecRedis;
import com.epmet.service.ActLiveRecService;
import com.epmet.service.ActSignInRecService;
import com.epmet.utils.ValidityVerification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.UUID;
/**
* 活动签到记录
@ -57,9 +58,6 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
@Autowired
private ActUserRelationDao actUserRelationDao;
@Autowired
private ActUserLogDao actUserLogDao;
@Autowired
private ActSignInPicDao actSignInPicDao;
@ -70,6 +68,12 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
@Transactional(rollbackFor = Exception.class)
public Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
// 文本校验
ValidityVerification verification = new ValidityVerification();
verification.textScanVerification(formDTO.getDesc(),"添加签到-文本内容审核失败");
// 图片校验
verification.imgScanVerification(formDTO.getImages(),"添加签到-图片审核失败");
// 更新用户活动关系表 SIGN_IN_FLAG字段更新为已签到
ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO();
actUserRelationDTO.setActId(formDTO.getActId());
@ -77,43 +81,31 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl<ActSignInRecDao, Ac
actUserRelationDTO.setSignInFlag(ActConstant.ACT_USER_STATUS_SIGNED_IN);
actUserRelationDao.updateUserRelationByActIdAndUserId(actUserRelationDTO);
// 存储用户活动关系日志表
ActUserLogEntity actUserLogEntity = new ActUserLogEntity();
actUserLogEntity.setActId(formDTO.getActId());
actUserLogEntity.setUserId(formDTO.getUserId());
actUserLogEntity.setOperationType(ActConstant.ACT_USER_STATUS_SIGNED_IN);
actUserLogDao.insert(actUserLogEntity);
ActSignInRecDTO dto = ConvertUtils.sourceToTarget(formDTO, ActSignInRecDTO.class);
//" 实况id,当sync_live=1时此列有值"
String liveId = "";
if (formDTO.getSyncLive() == 1){
if (formDTO.getSyncLive() == NumConstant.ONE){
// 签到内容同步到实况
ResiActInsertLiveFormDTO liveFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiActInsertLiveFormDTO.class);
Result<String> inSertlive = actLiveRecService.inSertlive(tokenDto, liveFormDTO);
liveId = inSertlive.getData();
//实况id, 当sync_live=1时此列有值
dto.setLiveId(inSertlive.getData());
}
// 存储活动签到记录表
ActSignInRecEntity actSignInRecEntity = new ActSignInRecEntity();
actSignInRecEntity.setActId(formDTO.getActId());
actSignInRecEntity.setUserId(formDTO.getUserId());
actSignInRecEntity.setLongitude(formDTO.getLongitude());
actSignInRecEntity.setLatitude(formDTO.getLatitude());
actSignInRecEntity.setAddress(formDTO.getAddress());
actSignInRecEntity.setDesc(formDTO.getDesc());
actSignInRecEntity.setSyncLive(formDTO.getSyncLive());
actSignInRecEntity.setLiveId(liveId);
baseDao.insert(actSignInRecEntity);
String uuid = UUID.randomUUID().toString().replaceAll("-","");
dto.setId(uuid);
baseDao.insertActSignInRec(dto);
//存储活动签到图片
List<String> imgList = formDTO.getImages();
for (int i = 0; i < imgList.size(); i++) {
String imgUrl = imgList.get(i);
ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity();
actLivePicEntity.setSignInId(actSignInRecEntity.getId());
actLivePicEntity.setPicUrl(imgUrl);
actLivePicEntity.setSort(i + NumConstant.ONE);
actSignInPicDao.insert(actLivePicEntity);
if (null != imgList){
for (int i = 0; i < imgList.size(); i++) {
String imgUrl = imgList.get(i);
ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity();
actLivePicEntity.setSignInId(uuid);
actLivePicEntity.setPicUrl(imgUrl);
actLivePicEntity.setSort(i + NumConstant.ONE);
actSignInPicDao.insert(actLivePicEntity);
}
}
return new Result();
}

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

@ -42,7 +42,7 @@ import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.entity.ActUserLogEntity;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.entity.HeartUserInfoEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.ActUserRelationRedis;
import com.epmet.service.ActInfoService;
import com.epmet.service.ActUserLogService;
@ -76,7 +76,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Autowired
private VolunteerInfoDao volunteerInfoDao;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private HeartUserInfoDao heartUserInfoDao;
@ -188,7 +188,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
ActUserLogDTO userLogDTO = new ActUserLogDTO();
userLogDTO.setActId(formDTO.getActId());
userLogDTO.setUserId(tokenDto.getUserId());
userLogDTO.setOperationType(ActConstant.ACT_USER_STATUS_CANCELD);
userLogDTO.setOperationType(ActConstant.ACT_USER_LOG_OPER_CANCELD);
userLogDTO.setReason(formDTO.getFailureReason());
actUserLogService.save(userLogDTO);
return new Result();
@ -201,35 +201,33 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
boolean satisfy = false;
// 查询活动信息
ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId());
// >0 当前用户是志愿者
Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getActId());
if (actInfoDTO.getVolunteerLimit()){
// 活动只能志愿者参加
Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getUserId());
if (volunteerFlag > NumConstant.ZERO){
satisfy = true;
} else {
logger.info("活动报名失败,请先认证志愿者");
throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
}
// 活动只能志愿者参加, 当前用户是否满足条件
satisfy = this.volunteerParticipationAct(volunteerFlag);
} else {
// 活动不限制志愿者身份,但要求是 居民身份
Result<List<UserRoleResultDTO>> userRoleInfo = epmetUserFeignClient.getUserRoleInfoByUserId(formDTO.getUserId());
for (UserRoleResultDTO roleResultDTO :userRoleInfo.getData()){
if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(roleResultDTO.getRoleKey())){
satisfy = true;
}
}
if (!satisfy){
logger.info("活动报名失败,请完善居民信息");
throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
}
// 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件
satisfy = this.resiParticipationAct(formDTO.getUserId());
}
if (satisfy){
this.actStartSignUp(actInfoDTO, formDTO);
// 开始报名
this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag);
}
return new Result();
}
private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO){
/**
* 开始报名活动
*
* @param actInfoDTO 活动详情
* @param formDTO 接口请求入参
* @param volunteerFlag >0 当前用户是志愿者
* @return void
* @Author zhangyong
* @Date 15:31 2020-07-24
**/
private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){
boolean signUp = true;
Integer auditingNum = actUserLogService.countActTimesOfParticipation(formDTO.getUserId());
if (auditingNum > NumConstant.ZERO){
@ -246,7 +244,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
HeartUserInfoEntity entity = new HeartUserInfoEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setUserId(formDTO.getUserId());
entity.setVolunteerFlag(true);
entity.setVolunteerFlag(volunteerFlag > NumConstant.ZERO);
entity.setKindnessTime(NumConstant.ZERO);
entity.setParticipationNum(NumConstant.ZERO);
entity.setObtainPointNum(NumConstant.ZERO);
@ -264,8 +262,53 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
ActUserLogEntity userLogEntity = new ActUserLogEntity();
userLogEntity.setActId(formDTO.getActId());
userLogEntity.setUserId(formDTO.getUserId());
userLogEntity.setOperationType(ActConstant.ACT_USER_STATUS_AUDITING);
userLogEntity.setOperationType(ActConstant.ACT_USER_LOG_OPER_AUDITING);
actUserLogService.insert(userLogEntity);
}
}
/**
* 活动报名限制必须是志愿者身份当前用户是否符合
* @param volunteerFlag
* @return boolean
* @Author zhangyong
* @Date 15:04 2020-07-24
**/
private boolean volunteerParticipationAct(Integer volunteerFlag){
boolean satisfy = false;
// 活动只能志愿者参加
if (volunteerFlag > NumConstant.ZERO){
satisfy = true;
return satisfy;
} else {
logger.info("活动报名失败,请先认证志愿者");
throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
}
}
/**
* 活动报名不限制志愿者身份但要求是 居民身份当前用户是否符合
* @param userId
* @return boolean
* @Author zhangyong
* @Date 15:04 2020-07-24
**/
private boolean resiParticipationAct(String userId){
boolean satisfy = false;
// 活动不限制志愿者身份,但要求是 居民身份
Result<List<UserRoleResultDTO>> userRoleInfo = epmetUserOpenFeignClient.getUserRoleInfoByUserId(userId);
if (userRoleInfo.success()){
for (UserRoleResultDTO roleResultDTO :userRoleInfo.getData()){
if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(roleResultDTO.getRoleKey())){
satisfy = true;
}
}
}
if (!satisfy){
logger.info("活动报名失败,请完善居民信息");
throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
} else {
return satisfy;
}
}
}

58
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java

@ -20,21 +20,24 @@ 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.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.HeartUserInfoDao;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.resi.ResiActBaseFormDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiLeaderboardResultDTO;
import com.epmet.entity.HeartUserInfoEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.HeartUserInfoRedis;
import com.epmet.service.HeartUserInfoService;
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;
@ -52,11 +55,11 @@ import java.util.Map;
*/
@Service
public class HeartUserInfoServiceImpl extends BaseServiceImpl<HeartUserInfoDao, HeartUserInfoEntity> implements HeartUserInfoService {
private Logger logger = LogManager.getLogger(HeartUserInfoServiceImpl.class);
@Autowired
private HeartUserInfoRedis heartUserInfoRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public PageData<HeartUserInfoDTO> page(Map<String, Object> params) {
@ -124,28 +127,35 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl<HeartUserInfoDao,
@Override
public Result<List<ResiLeaderboardResultDTO>> leaderboard(ResiActBaseFormDTO formDTO) {
List<ResiLeaderboardResultDTO> resultDTOS = new ArrayList<>();
// 获取排好序的 排行榜
List<HeartUserInfoDTO> leaderboardList = baseDao.selectListLeaderboard(formDTO);
// 根据用户ID获取微信昵称、头像
List<String> userIds = new ArrayList<>();
for (HeartUserInfoDTO list : leaderboardList){
userIds.add(list.getUserId());
}
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds);
List<ResiLeaderboardResultDTO> resultDTOS = new ArrayList<>();
for (HeartUserInfoDTO list : leaderboardList){
ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO();
dto.setKindnessTime(list.getKindnessTime());
dto.setVolunteerFlag(list.getVolunteerFlag());
dto.setParticipationNum(list.getParticipationNum());
List<UserBaseInfoResultDTO> wxInfo = userWxInfos.getData();
for (UserBaseInfoResultDTO wx : wxInfo){
if (list.getUserId().equals(wx.getUserId())){
dto.setHeadImg(wx.getHeadImgUrl());
dto.setNickname(wx.getNickname());
if (leaderboardList.size() > NumConstant.ZERO){
// 根据用户ID获取微信昵称、头像
List<String> userIds = new ArrayList<>();
for (HeartUserInfoDTO list : leaderboardList){
userIds.add(list.getUserId());
}
// 查询用户微信基础信息
Result<List<UserBaseInfoResultDTO>> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
if (userWxInfos.success() && userWxInfos.getData().size() > NumConstant.ZERO){
for (HeartUserInfoDTO list : leaderboardList){
ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO();
dto.setKindnessTime(list.getKindnessTime());
dto.setVolunteerFlag(list.getVolunteerFlag());
dto.setParticipationNum(list.getParticipationNum());
List<UserBaseInfoResultDTO> wxInfo = userWxInfos.getData();
for (UserBaseInfoResultDTO wx : wxInfo){
if (list.getUserId().equals(wx.getUserId())){
dto.setHeadImg(wx.getHeadImgUrl());
dto.setNickname(wx.getNickname());
}
}
resultDTOS.add(dto);
}
} else {
logger.info("查询用户基本信息接口返回失败");
throw new RenException("查询用户基本信息失败");
}
}
return new Result<List<ResiLeaderboardResultDTO>>().ok(resultDTOS);

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

@ -17,34 +17,24 @@
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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.WxUserInfoFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.VolunteerInfoRedis;
import com.epmet.service.HeartUserInfoService;
import com.epmet.service.VolunteerInfoService;
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;
/**
* 志愿者信息
*
@ -58,7 +48,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
private VolunteerInfoRedis volunteerInfoRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private HeartUserInfoService heartUserInfoService;
@ -76,6 +66,9 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
} else {
// 不是志愿者:插入志愿者信息表
baseDao.insert(volunteerInfoEntity);
// 发送消息 由积分系统消费消息(需要使用规则)
//?
// 更新用户信息表的 是否是志愿者标识
HeartUserInfoDTO userInfoDTO = new HeartUserInfoDTO();
userInfoDTO.setUserId(tokenDto.getUserId());
@ -84,6 +77,6 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
}
// 更新用户基础信息表 并 更新用户微信表
WxUserInfoFormDTO wxUserInfoFormDTO = ConvertUtils.sourceToTarget(formDTO, WxUserInfoFormDTO.class);
return epmetUserFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO);
return epmetUserOpenFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO);
}
}

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

@ -64,11 +64,13 @@ public class ValidityVerification {
/**
* 图片列表校验
* @param imgList 被校验的图片列表
* @param businessEnum 业务枚举定义校验失败后输出的日志信息
*
* @return void
* @auther zhangyong
* @Date 14:42 2020-07-15
**/
public void imgScanVerification(List<String> imgList){
public void imgScanVerification(List<String> imgList, String businessEnum){
if (NumConstant.ZERO != imgList.size()){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
imgList.forEach(url -> {
@ -82,6 +84,8 @@ public class ValidityVerification {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
// 业务枚举:例如:评论话题失败,评论内容为:%s"
log.error(String.format(businessEnum));
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}

16
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml

@ -118,13 +118,7 @@ pagehelper:
helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
#亿联云消息网关
elink:
mq:
appId: @elink.mq.appId@ #项目接入亿联云的应用Id
token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
host: @elink.mq.host@ #亿联云消息网关服务地址
sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径
openapi:
scan:
server:
@ -132,3 +126,11 @@ openapi:
method:
imgSyncScan: /imgSyncScan
textSyncScan: /textSyncScan
#亿联云消息网关
elink:
mq:
appId: @elink.mq.appId@ #项目接入亿联云的应用Id
token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
host: @elink.mq.host@ #亿联云消息网关服务地址
sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径

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

@ -450,12 +450,12 @@
resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM act_info
WHERE DEL_FLAG = '0'
AND USER_ID = #{userId}
AND ACT_STATUS = 'published'
AND ((#{actStartTime} BETWEEN ACT_START_TIME AND ACT_END_TIME OR #{actEndTime} BETWEEN ACT_START_TIME AND ACT_END_TIME)
or (ACT_START_TIME BETWEEN #{actStartTime} AND #{actEndTime} OR ACT_END_TIME BETWEEN #{actStartTime} AND #{actEndTime}));
FROM act_info i LEFT JOIN act_user_relation r ON i.ID = r.ACT_ID
WHERE i.DEL_FLAG = '0'
AND r.USER_ID = #{userId}
AND i.ACT_STATUS = 'published'
AND ((#{actStartTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME OR #{actEndTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME)
or (i.ACT_START_TIME BETWEEN #{actStartTime} AND #{actEndTime} OR i.ACT_END_TIME BETWEEN #{actStartTime} AND #{actEndTime}));
</select>
<!-- 查询正在进行中的活动列表 -->

31
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml

@ -48,4 +48,35 @@
</foreach>
order by SORT asc
</select>
<insert id="insertActLiveRec" parameterType="com.epmet.dto.form.resi.ResiActInsertLiveFormDTO">
INSERT INTO act_live_rec (
ID,
ACT_ID,
USER_ID,
LONGITUDE,
LATITUDE,
ADDRESS,
`DESC`,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME)
VALUES
( #{id},
#{actId},
#{userId},
#{longitude},
#{latitude},
#{address},
#{desc},
0,
0,
#{userId},
now(),
#{userId},
now())
</insert>
</mapper>

35
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml

@ -21,5 +21,38 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<insert id="insertActSignInRec" parameterType="com.epmet.dto.ActSignInRecDTO">
INSERT INTO act_sign_in_rec (
ID,
ACT_ID,
USER_ID,
LONGITUDE,
LATITUDE,
ADDRESS,
`DESC`,
SYNC_LIVE,
LIVE_ID,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME)
VALUES
( #{id},
#{actId},
#{userId},
#{longitude},
#{latitude},
#{address},
#{desc},
#{syncLive},
#{liveId},
0,
0,
#{userId},
now(),
#{userId},
now())
</insert>
</mapper>

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

@ -45,8 +45,7 @@
resultType="com.epmet.dto.HeartUserInfoDTO">
SELECT
ui.USER_ID userId,
volunteerFlag,
IF(ui.VOLUNTEER_FLAG = 1, true , false )
ui.VOLUNTEER_FLAG volunteerFlag,
ui.KINDNESS_TIME kindnessTime,
ui.PARTICIPATION_NUM participationNum
FROM heart_user_info ui

3
epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java

@ -8,6 +8,7 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import com.epmet.commons.tools.utils.Result;
@ -25,7 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
* @author Mark sunlightcs@gmail.c om
* @since 1.1.0
*/
@FeignClient(name = "renren-oss-server", configuration = OssFeignClient.MultipartSupportConfig.class)
@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, configuration = OssFeignClient.MultipartSupportConfig.class)
public interface OssFeignClient {
/**
* 文件上传

2
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java

@ -61,7 +61,7 @@ public class CodeOperationHistoryDTO implements Serializable {
/**
* 描述
*/
private String describe;
private String description;
/**
* 乐观锁

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

@ -0,0 +1,86 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @CreateTime 2020/7/24 9:22
*/
@Data
public class AuthResultRecordFormDTO implements Serializable {
private static final long serialVersionUID = -5359209459022630868L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* resi居民端work工作端
*/
private String clientType;
/**
* 第三方平台AppId 第三方平台AppId
*/
private String componentAppId;
/**
* 微信返回创建时间 微信返回创建时间
*/
private Date wechatCreateTime;
/**
* 通知类型
*/
private String InfoType;
/**
* 授权方AppId
*/
private String AuthorizerAppid;
/**
* 授权码auth_code
*/
private String AuthorizationCode;
/**
* 授权码过期时间
*/
private Date ExpiredTime;
/**
* 预授权码
*/
private String PreAuthCode;
/**
* 删除状态
*/
private Integer delFlag = 0;
/**
* 乐观锁
*/
private Integer revision = 0;
/**
* 创建人
*/
private String createdBy = "APP_USER";
/**
* 更新人
*/
private String updatedBy = "APP_USER";
}

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

@ -44,6 +44,11 @@ public class AuthorizationInfoFormDTO implements Serializable {
*/
private String clientType;
/**
* 权限列表
*/
private String funcInfo;
private Integer delFlag = 0;
private String createdBy = "APP_USER";

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

@ -34,6 +34,11 @@ public class AuthorizerAccessTokenFormDTO implements Serializable {
*/
private String authAppid;
/**
* 客户端类型resi居民端work工作端
*/
private String clientType;
/**
* 客户ID
*/

24
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java

@ -43,84 +43,100 @@ public class SubmitAuditFormDTO implements Serializable {
/**
* 用户生成内容场景UGC信息安全声明
*/
private List<UgcDeclareBean> ugcDeclare;
private UgcDeclareBean ugcDeclare;
@NoArgsConstructor
@Data
private static class ItemListBean {
public 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 {
public 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 {
public 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;
}
}

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

@ -38,9 +38,9 @@ public class UploadListFormDTO implements Serializable {
/**
* 页数
*/
private Integer page;
private Integer pageNo;
/**
* 页面条数
*/
private Integer limit;
private Integer pageSize;
}

31
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* @Description 公众号-手机号注册-接口返参
*/
@Data
public class RegisterResultDTO implements Serializable {
private static final long serialVersionUID = 3253989119352850315L;
/**
* userId
*/
private String userId;
/**
* 用户微信openid
*/
private String openId;
/**
* 用户微信unionId
*/
private String unionId;
}

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

@ -3,12 +3,10 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.dto.form.WxLoginFormDTO;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.InitCustomerResultDTO;
import com.epmet.dto.result.PublicCustomerResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.fallback.EpmetThirdFeignClientFallback;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.cloud.openfeign.FeignClient;
@ -106,4 +104,13 @@ public interface EpmetThirdFeignClient {
**/
@PostMapping(value = "third/customermp/getcustomermsg/{appId}")
Result<PublicCustomerResultDTO> getCustomerMsg(@PathVariable("appId") String appId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 用户登陆新增访问记录数据
**/
@PostMapping(value = "third/pacustomer/register")
Result<RegisterResultDTO> register(@RequestBody RegisterFormDTO formDTO);
}

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

@ -4,12 +4,10 @@ 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.UserWechatDTO;
import com.epmet.dto.form.RegisterFormDTO;
import com.epmet.dto.form.SaveUserVisitedFormDTO;
import com.epmet.dto.form.WxLoginFormDTO;
import com.epmet.dto.result.CustomerUserResultDTO;
import com.epmet.dto.result.InitCustomerResultDTO;
import com.epmet.dto.result.PublicCustomerResultDTO;
import com.epmet.dto.result.SaveUserResultDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetThirdFeignClient;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.stereotype.Component;
@ -65,4 +63,9 @@ public class EpmetThirdFeignClientFallback implements EpmetThirdFeignClient {
public Result<PublicCustomerResultDTO> getCustomerMsg(String appId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getCustomerMsg", appId);
}
@Override
public Result<RegisterResultDTO> register(RegisterFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "register", formDTO);
}
}

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

8
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.39</version>
<version>0.0.48</version>
<parent>
<groupId>com.epmet</groupId>
@ -135,6 +135,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-oss-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

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

@ -22,9 +22,12 @@ public interface ModuleConstant {
String AUTHORIZATION_CODE_HUMP = "AuthorizationCode";
String UNAUTHORIZED = "unauthorized";
String AUTHORIZED = "authorized";
String UPDATE_AUTHORIZED = "updateauthorized";
String NULL_CHAR = "";
String SUCCESS = "success";
String AUTHORIZER_APP_ID_HUMP = "AuthorizerAppid";
String PRE_AUTH_CODE_HUMP = "PreAuthCode";
String AUTHORIZATION_CODE_EXPIRED_TIME = "AuthorizationCodeExpiredTime";
// 获取 component_access_token 如下
String COMPONENT_APPID = "component_appid";
@ -65,7 +68,7 @@ public interface ModuleConstant {
String COMPONENT_APP_ID = "component_appid";
String AUTHORIZER_APP_ID = "authorizer_appid";
String AUTHORIZER_INFO = "authorizer_info";
String MINI_PROGRAM_INFO = "miniprograminfo";
String MINI_PROGRAM_INFO = "MiniProgramInfo";
String BUSINESS_INFO = "business_info";
String CATEGORIES = "categories";
String NETWORK = "network";

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

@ -22,6 +22,14 @@ public interface PaConstant {
* 保存用户访问记录数据失败
*/
String SAVE_VISITED_EXCEPTION = "保存用户访问记录数据失败";
/**
* 保存用户数据失败
*/
String SAVE_USER_EXCEPTION = "保存用户数据失败";
/**
* 保存用户微信基本数据失败
*/
String SAVE_WECHAT_EXCEPTION = "保存用户微信信息失败";
/**
* 组织级别对应的keyname

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

@ -44,7 +44,7 @@ public interface ThirdRedisKeyConstant {
/**
* authorization_info 授权信息
*/
String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo";
String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo:";
}

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

@ -46,7 +46,7 @@ public interface ThirdRunTimeInfoConstant {
String END_GET_AUTH_INFO = "=====================结束获取【authorization_info】=====================";
String CREATE_AND_BIND_SUCCESS = "创建开放平台帐号并绑定公众号/小程序";
String CREATE_AND_BIND_SUCCESS = "开始创建开放平台帐号并绑定公众号/小程序";
String BIND_SUCCESS = "绑定公众号/小程序到开放平台";
@ -82,4 +82,6 @@ public interface ThirdRunTimeInfoConstant {
String VERIFY_TICKET = "msgSignature = %s, timeStamp = %s, nonce = %s, encryptType = %s, signature = %s";
String REFRESH_AUTH_ACCESS_TOKEN = "查询到新的 授权方【access_token】";
}

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

@ -49,7 +49,7 @@ public class CodeController {
* @date 2020/7/17 16:22
*/
@PostMapping("getextjson")
public Result<String> getExtJson(CodeUploadFormDTO formDTO) {
public Result<String> getExtJson(@RequestBody CodeUploadFormDTO formDTO) {
String extJson = codeService.getExtJson(formDTO);
return new Result<String>().ok(extJson);
}
@ -175,7 +175,7 @@ public class CodeController {
* @date 2020/7/17 11:20
*/
@PostMapping("mediaupload")
public Result<String> mediaUpload(@RequestBody MediaUploadFormDTO formDTO) {
public Result<String> mediaUpload(MediaUploadFormDTO formDTO) {
String result = codeService.mediaUpload(formDTO);
return new Result<String>().ok(result);
}

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

@ -45,11 +45,8 @@ public class PaCustomerController {
* @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();
public Result<RegisterResultDTO> register(@RequestBody RegisterFormDTO formDTO) {
return new Result<RegisterResultDTO>().ok(paCustomerService.register(formDTO));
}
/**

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

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.AuthResultRecordFormDTO;
import com.epmet.entity.AuthResultRecordEntity;
import org.apache.ibatis.annotations.Mapper;
@ -30,4 +31,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AuthResultRecordDao extends BaseDao<AuthResultRecordEntity> {
/**
* @Description 插入授权结果记录
* @param formDTO
* @author zxc
*/
void insertAuthResultRecord(AuthResultRecordFormDTO formDTO);
}

23
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.AuthorizationInfoDTO;
import com.epmet.dto.form.AuthorizationInfoFormDTO;
import com.epmet.dto.form.AuthorizerAccessTokenFormDTO;
import com.epmet.dto.result.AuthCodeResultDTO;
import com.epmet.dto.result.WillOverDueResultDTO;
import com.epmet.entity.AuthorizationInfoEntity;
import org.apache.ibatis.annotations.Mapper;
@ -44,13 +45,6 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
*/
void insertAuthorizationInfo(AuthorizationInfoFormDTO formDTO);
/**
* @Description 逻辑删除授权信息
* @param customerId
* @author zxc
*/
void updateOldAuthorizationInfo(@Param("customerId")String customerId);
/**
* 根据客户ID客户端类型获取授权信息
* @author zhaoqifeng
@ -60,7 +54,13 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
* @return com.epmet.dto.AuthorizationInfoDTO
*/
AuthorizationInfoDTO getAuthInfoByCustomer(@Param("customerId") String customerId, @Param("clientType") String clientType);
void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType);
/**
* @Description 逻辑删除授权信息
* @param authAppId
* @author zxc
*/
void updateOldAuthorizationInfo(@Param("authAppId")String authAppId);
/**
* @Description 查询即将过期的 authorizer_access_token
@ -83,4 +83,11 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
*/
void updateOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType);
/**
* @Description 根据 authAppId 查询客户ID和客户端类型
* @param authAppId
* @author zxc
*/
AuthCodeResultDTO selectCustomerIdByAuthAppId(@Param("authAppId")String authAppId);
}

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

@ -39,10 +39,10 @@ public interface ComponentVerifyTicketDao extends BaseDao<ComponentVerifyTicketE
void insertComponentVerifyTicket(ComponentVerifyTicketFormDTO formDTO);
/**
* @Description 逻辑删除 component_verify_ticket
* @Description 物理删除 component_verify_ticket
* @param
* @author zxc
*/
void updateOldComponentVerifyTicket();
void deleteOldComponentVerifyTicket();
}

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

@ -58,7 +58,7 @@ public interface CustomerMpDao extends BaseDao<CustomerMpEntity> {
* @param customerId
* @author zxc
*/
Integer selectAuthCount(@Param("customerId")String customerId);
List<String> selectAuthCount(@Param("customerId")String customerId);
/**
* @Description 回填customer_mp的appId
@ -107,4 +107,12 @@ public interface CustomerMpDao extends BaseDao<CustomerMpEntity> {
* @Description 根据appId查询客户信息
**/
PaCustomerDTO selectCustomerByAppId(@Param("appId") String appId);
/**
* @Description 校验此小程序是不是绑定别的客户端
* @param authAppId
* @param clientType
* @author zxc
*/
Integer checkBind(String authAppId,String clientType);
}

7
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenPlatformAccountDao.java

@ -41,6 +41,13 @@ public interface OpenPlatformAccountDao extends BaseDao<OpenPlatformAccountEntit
*/
void insertOpenPlatFormAccount(CreateOpenFormDTO coForm);
/**
* @Description 删除客户下报废的开放平台账号信息
* @param customerId
* @author zxc
*/
void deleteOldOpenPlatFprmAccount(@Param("customerId")String customerId);
/**
* @Description 根据客户Id查询已绑定开放平台的账号ID
* @param customerId

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

@ -18,8 +18,10 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PaUserVisitedDTO;
import com.epmet.entity.PaUserVisitedEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 公众号登陆记录表
@ -30,4 +32,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PaUserVisitedDao extends BaseDao<PaUserVisitedEntity> {
/**
* @param openId
* @return
* @Author sun
* @Description 根据openId查询登陆访问记录数据按时间倒序
**/
PaUserVisitedDTO selectByOpenId(@Param("openId") String openId);
}

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

@ -23,6 +23,8 @@ import com.epmet.entity.PaUserWechatEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 公众号用户信息
*
@ -38,7 +40,7 @@ public interface PaUserWechatDao extends BaseDao<PaUserWechatEntity> {
* @Author sun
* @Description 根据openId查询user_wechat表信息
**/
PaUserWechatDTO selectWechatByOpenId(@Param("openId") String openId);
List<PaUserWechatDTO> selectWechatByOpenId(@Param("openId") String openId);
/**
* @param dto

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java

@ -61,6 +61,6 @@ public class CodeOperationHistoryEntity extends BaseEpmetEntity {
/**
* 描述
*/
private String describe;
private String description;
}

5
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java

@ -121,8 +121,9 @@ public class RedisThird {
* @author zxc
*/
public void setAuthInfo(AuthorizationInfoResultDTO authInfo,String customerId,String clientType){
String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY+ThirdRedisKeyConstant.COLON+customerId+ThirdRedisKeyConstant.COLON+clientType;
redisUtils.set(key,authInfo,-1);
Map<String, Object> map = BeanUtil.beanToMap(authInfo, false, true);
String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + customerId+ThirdRedisKeyConstant.COLON + clientType;
redisUtils.hMSet(key, map,NOT_EXPIRE);
}
}

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

Loading…
Cancel
Save