Browse Source

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

dev
jianjun 5 years ago
parent
commit
11c1ae3302
  1. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java
  2. 2
      epmet-gateway/deploy/docker-compose-dev.yml
  3. 2
      epmet-gateway/pom.xml
  4. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  5. 5
      epmet-module/data-report/data-report-client/pom.xml
  6. 31
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/CompartmentByBizTypeFormDTO.java
  7. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AgencyDistributionResultDTO.java
  8. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java
  9. 51
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDetailResultDTO.java
  10. 2
      epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml
  11. 2
      epmet-module/data-report/data-report-server/pom.xml
  12. 21
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/backdoor/BackDoorController.java
  13. 13
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java
  14. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java
  15. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  16. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenDifficultyDataDao.java
  17. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/BackDoorService.java
  18. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/impl/BackDoorServiceImpl.java
  19. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
  20. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenDifficultyDataService.java
  21. 19
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  22. 30
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java
  23. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java
  24. 29
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java
  25. 33
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  26. 26
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml
  27. 4
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java
  28. 2
      epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-dev.yml
  29. 2
      epmet-module/epmet-common-service/common-service-server/pom.xml
  30. 4
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java
  31. 7
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/WxMsgTemplateSubscribeStatus.java
  32. 126
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpMsgSendRecordDTO.java
  33. 101
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpResiUserSubscribeDTO.java
  34. 108
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpTemplateMsgSubscribeStatusDTO.java
  35. 106
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUserSubscribeRecordDTO.java
  36. 101
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpWorkUserSubscribeDTO.java
  37. 31
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/TemplateListFormDTO.java
  38. 42
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxMsgAuthInfoFormDTO.java
  39. 57
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeMessageFormDTO.java
  40. 41
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/WxMsgAuthInfoResultDTO.java
  41. 10
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java
  42. 6
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java
  43. 2
      epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml
  44. 18
      epmet-module/epmet-message/epmet-message-server/pom.xml
  45. 61
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/WxmpMessageConstant.java
  46. 2
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java
  47. 127
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java
  48. 94
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMsgSendRecordController.java
  49. 94
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpResiUserSubscribeController.java
  50. 94
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpTemplateMsgSubscribeStatusController.java
  51. 94
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUserSubscribeRecordController.java
  52. 94
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpWorkUserSubscribeController.java
  53. 34
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpMsgSendRecordDao.java
  54. 88
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpResiUserSubscribeDao.java
  55. 44
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpTemplateMsgSubscribeStatusDao.java
  56. 33
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUserSubscribeRecordDao.java
  57. 90
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpWorkUserSubscribeDao.java
  58. 96
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpMsgSendRecordEntity.java
  59. 71
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpResiUserSubscribeEntity.java
  60. 79
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpTemplateMsgSubscribeStatusEntity.java
  61. 76
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUserSubscribeRecordEntity.java
  62. 71
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpWorkUserSubscribeEntity.java
  63. 89
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpMsgSendRecordExcel.java
  64. 74
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpResiUserSubscribeExcel.java
  65. 77
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpTemplateMsgSubscribeStatusExcel.java
  66. 77
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUserSubscribeRecordExcel.java
  67. 74
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpWorkUserSubscribeExcel.java
  68. 43
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/exception/WxSubscribeException.java
  69. 30
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMessageRedis.java
  70. 47
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMsgSendRecordRedis.java
  71. 47
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpResiUserSubscribeRedis.java
  72. 47
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpTemplateMsgSubscribeStatusRedis.java
  73. 47
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUserSubscribeRecordRedis.java
  74. 47
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpWorkUserSubscribeRedis.java
  75. 57
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java
  76. 105
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMsgSendRecordService.java
  77. 95
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpResiUserSubscribeService.java
  78. 95
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpTemplateMsgSubscribeStatusService.java
  79. 95
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUserSubscribeRecordService.java
  80. 95
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpWorkUserSubscribeService.java
  81. 473
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java
  82. 109
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMsgSendRecordServiceImpl.java
  83. 104
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpResiUserSubscribeServiceImpl.java
  84. 104
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpTemplateMsgSubscribeStatusServiceImpl.java
  85. 104
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUserSubscribeRecordServiceImpl.java
  86. 104
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpWorkUserSubscribeServiceImpl.java
  87. 48
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpMsgSendRecordDao.xml
  88. 95
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpResiUserSubscribeDao.xml
  89. 49
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpTemplateMsgSubscribeStatusDao.xml
  90. 8
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUserSubscribeRecordDao.xml
  91. 88
      epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpWorkUserSubscribeDao.xml
  92. 31
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java
  93. 25
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GetTemplateListResultDTO.java
  94. 37
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PersonalTemplateController.java
  95. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java
  96. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java
  97. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java
  98. 13
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml
  99. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java
  100. 7
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java

18
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java

@ -11,21 +11,23 @@ import org.springframework.core.env.Environment;
* @date 2020-07-03 11:14
**/
public enum EnvEnum {
LOCAL("local", "本地环境"),
DEV("dev", "开发环境"),
TEST("test", "体验环境"),
PROD("prod", "生产环境"),
UN_KNOWN("un_known", "未知"),
LOCAL("local", "本地环境","http://localhost:8080/api/"),
DEV("dev", "开发环境","http://192.168.1.130:8080/api/"),
TEST("test", "体验环境","https://epmet-dev.elinkservice.cn/api/"),
PROD("prod", "生产环境","https://epmet-cloud.elinkservice.cn/api/"),
UN_KNOWN("un_known", "未知","https://epmet-dev.elinkservice.cn/api/"),
;
private String code;
private String name;
private String url;
EnvEnum(String code, String name) {
EnvEnum(String code, String name, String url) {
this.code = code;
this.name = name;
this.url = url;
}
public static EnvEnum getEnum(String code) {
@ -59,4 +61,8 @@ public enum EnvEnum {
public String getName() {
return name;
}
public String getUrl(){
return url;
}
}

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

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-gateway-server:
container_name: epmet-gateway-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.44
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.45
ports:
- "8080:8080"
network_mode: host # 使用现有网络

2
epmet-gateway/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.44</version>
<version>0.3.45</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId>

1
epmet-gateway/src/main/resources/bootstrap.yml

@ -61,6 +61,7 @@ spring:
- Path=${server.servlet.context-path}/message/**
filters:
- StripPrefix=1
- CpAuth=true
#工作流服务
- id: epmet-activiti-server
uri: @gateway.routes.epmet-activiti-server.uri@

5
epmet-module/data-report/data-report-client/pom.xml

@ -17,6 +17,11 @@
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-project-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>

31
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/CompartmentByBizTypeFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.evaluationindex.screen.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/10/22
*/
@Data
public class CompartmentByBizTypeFormDTO implements Serializable {
private static final long serialVersionUID = -3354778434424878413L;
public interface CompartmentByBizType extends CustomerClientShowGroup {}
/**
* 机关ID
*/
@NotBlank(message = "机关ID不能为空",groups = {CompartmentByBizType.class})
private String agencyId;
/**
* 业务类型
*/
@NotBlank(message = "bizType不能为空", groups = {CompartmentByBizType.class})
private String bizType;
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AgencyDistributionResultDTO.java

@ -37,4 +37,9 @@ public class AgencyDistributionResultDTO implements Serializable {
* 组织agency; 网格grid ; 部门dept
*/
private String type;
public AgencyDistributionResultDTO() {
this.subAreaMarks = "";
this.subCenterMark = "";
}
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/constant/ProjectConstant.java

@ -20,4 +20,6 @@ public interface ProjectConstant {
*/
String TYPE_EXCEPTION = "必要参数为空或参数格式错误";
String PROCESS_FAILURE = "查询项目进展失败......";
}

51
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectDetailResultDTO.java

@ -0,0 +1,51 @@
package com.epmet.project.dto.result;
import com.epmet.dto.result.ProcesslistResultDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/10/23 10:13 上午
*/
@Data
public class ProjectDetailResultDTO implements Serializable {
private static final long serialVersionUID = 2450826789942547426L;
/** 事件 = 项目
* 事件标题
*/
private String eventTitle;
/**
* 事件内容
*/
private String eventContent;
/**
* 事件来源
*/
private String eventSource;
/**
* 事件图片集合
*/
private List<String> imgUrlList;
/**
* 项目进展
*/
private List<ProcesslistResultDTO> processList;
public ProjectDetailResultDTO() {
this.eventTitle = "";
this.eventContent = "";
this.eventSource = "";
this.imgUrlList = new ArrayList<>();
this.processList = new ArrayList<>();
}
}

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

@ -2,7 +2,7 @@ version: "3.7"
services:
data-report-server:
container_name: data-report-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.118
image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.124
ports:
- "8109:8109"

2
epmet-module/data-report/data-report-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.118</version>
<version>0.3.124</version>
<artifactId>data-report-server</artifactId>
<parent>

21
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/backdoor/BackDoorController.java

@ -1,6 +1,5 @@
package com.epmet.datareport.controller.backdoor;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.service.backdoor.BackDoorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -16,9 +15,23 @@ public class BackDoorController {
@Autowired
private BackDoorService backDoorService;
@PostMapping("backdoor")
public Object backDoor(@RequestHeader("Data-Type")String dataType, @RequestHeader("AppId")String appId, @RequestHeader("target")String target, @RequestBody(required = false) Object o){
return backDoorService.backDoor(dataType,appId,target,o);
/**
* desc: 重定向到target 方法适用于外部鉴权接口的查询 比如大屏的查询接口
*
* @param dataType
* @param appId
* @param target
* @param targetParam
* @return java.lang.String
* @author LiuJanJun
* @date 2020/10/23 1:44 下午
*/
@PostMapping("redirect/external")
public Object backDoor(@RequestHeader(value = "Data-Type", defaultValue = "real", required = false) String dataType,
@RequestHeader(value = "env", defaultValue = "test", required = false) String env,
@RequestHeader("AppId") String appId, @RequestHeader("target") String target,
@RequestBody(required = false) Object targetParam) {
return backDoorService.redirect(dataType, appId, target, targetParam,env);
}
}

13
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.module.project.service.ProjectService;
import com.epmet.project.constant.ProjectConstant;
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO;
@ -78,4 +79,16 @@ public class ProjectController {
return new Result<List<ProjectIncrTrendResultDTO>>().ok(projectService.getProjectIncrTrend(tokenDto, formDTO));
}
/**
* @Description 项目详情
* @Param processListFormDTO
* @author zxc
* @date 2020/10/23 10:31 上午
*/
@PostMapping("projectdetail")
public Result<ProjectDetailResultDTO> projectDetail(@RequestBody ProcessListFormDTO processListFormDTO){
ValidatorUtils.validateEntity(processListFormDTO);
return new Result<ProjectDetailResultDTO>().ok(projectService.projectDetail(processListFormDTO));
}
}

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java

@ -3,6 +3,7 @@ package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.form.TreeByTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
@ -59,4 +60,10 @@ public class AgencyController {
return new Result<CompartmentResultDTO>().ok(agencyService.compartment(compartmentFormDTO));
}
@PostMapping("compartmentbybiztype")
public Result<CompartmentResultDTO> compartmentByBizType(@RequestBody CompartmentByBizTypeFormDTO compartmentFormDTO){
ValidatorUtils.validateEntity(compartmentFormDTO, CompartmentByBizTypeFormDTO.CompartmentByBizType.class);
return new Result<CompartmentResultDTO>().ok(agencyService.compartmentByBizType(compartmentFormDTO));
}
}

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -60,6 +60,8 @@ public interface ScreenCustomerAgencyDao {
*/
CompartmentResultDTO getAgencyAreaInfo(@Param("agencyId")String agencyId);
CompartmentResultDTO getAgencyAreaInfoByBizType(@Param("agencyId")String agencyId,@Param("bizType")String bizType);
/**
* @Description 查询子级区域分布信息机关级别
* @param agencyId
@ -67,6 +69,7 @@ public interface ScreenCustomerAgencyDao {
* @date 2020/8/18 5:12 下午
*/
List<AgencyDistributionResultDTO> selectSubDistribution(@Param("agencyId")String agencyId);
List<AgencyDistributionResultDTO> selectSubDistributionByType(@Param("agencyId")String agencyId,@Param("bizType")String bizType);
/**
* @Description 查询子级用户分布机关级别

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenDifficultyDataDao.java

@ -18,6 +18,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.result.DifficultProjectResultDTO;
import com.epmet.project.dto.result.ProjectDetailResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -41,4 +42,6 @@ public interface ScreenDifficultyDataDao {
**/
List<DifficultProjectResultDTO> selectDifficulty(@Param("agencyId")String agencyId,@Param("type")String type);
ProjectDetailResultDTO projectDetail(@Param("eventId")String projectId);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/BackDoorService.java

@ -1,13 +1,11 @@
package com.epmet.datareport.service.backdoor;
import com.epmet.commons.tools.utils.Result;
/**
* @Author zxc
* @DateTime 2020/10/21 5:17 下午
*/
public interface BackDoorService {
Object backDoor(String dataType, String appId, String target, Object o);
Object redirect(String dataType, String appId, String target, Object o,String env);
}

23
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/backdoor/impl/BackDoorServiceImpl.java

@ -1,11 +1,11 @@
package com.epmet.datareport.service.backdoor.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.constant.*;
import com.epmet.datareport.constant.FactConstant;
import com.epmet.datareport.service.backdoor.BackDoorService;
import com.epmet.dto.result.AppIdInfoResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
@ -28,24 +28,23 @@ public class BackDoorServiceImpl implements BackDoorService {
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Override
public Object backDoor(String dataType, String appId, String target, Object o) {
public Object redirect(String dataType, String appId, String target, Object targetParam, String env) {
Result<AppIdInfoResultDTO> appIdInfoResultDTOResult = commonServiceOpenFeignClient.appIdInfo(appId);
if (!appIdInfoResultDTOResult.success()){
if (!appIdInfoResultDTOResult.success()) {
throw new RenException("获取accessToken失败......");
}
AppIdInfoResultDTO data = appIdInfoResultDTOResult.getData();
String url = FactConstant.URL.concat(target);
Map<String,String> headerMap = new HashMap<>(16);
headerMap.put("AccessToken",data.getAccessToken());
headerMap.put("AppId",data.getAppId());
headerMap.put("AuthType","jwt");
String url = EnvEnum.getEnum(env).getUrl().concat(target);
Map<String, String> headerMap = new HashMap<>(16);
headerMap.put("AccessToken", data.getAccessToken());
headerMap.put("AppId", data.getAppId());
headerMap.put("AuthType", "jwt");
headerMap.put("Data-Type",dataType);
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(o),headerMap);
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(targetParam), headerMap);
log.info(JSON.toJSONString(stringResult));
if (!stringResult.success()){
throw new RenException("请求【"+url+"】失败......"+stringResult.error());
}
JSONObject jsonObject = JSON.parseObject(stringResult.getData());
return jsonObject;
return JSON.parseObject(stringResult.getData());
}
}

3
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java

@ -1,5 +1,6 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.form.TreeByTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
@ -32,4 +33,6 @@ public interface AgencyService {
*/
CompartmentResultDTO compartment(CompartmentFormDTO compartmentFormDTO);
CompartmentResultDTO compartmentByBizType(CompartmentByBizTypeFormDTO compartmentFormDTO);
}

14
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenDifficultyDataService.java

@ -0,0 +1,14 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.project.dto.result.ProjectDetailResultDTO;
/**
* @Author zxc
* @DateTime 2020/10/23 1:26 下午
*/
public interface ScreenDifficultyDataService {
ProjectDetailResultDTO projectDetail(ProcessListFormDTO processListFormDTO);
}

19
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java

@ -8,6 +8,7 @@ import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.form.TreeByTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO;
@ -206,4 +207,22 @@ public class AgencyServiceImpl implements AgencyService {
}
return agencyAreaInfo;
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public CompartmentResultDTO compartmentByBizType(CompartmentByBizTypeFormDTO compartmentFormDTO) {
CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfoByBizType(compartmentFormDTO.getAgencyId(),compartmentFormDTO.getBizType());
if (null == agencyAreaInfo){
return new CompartmentResultDTO();
}
if (agencyAreaInfo.getLevel().equals(ScreenConstant.COMMUNITY)){
// 当level为"community"时,查询screen_customer_grid表
List<AgencyDistributionResultDTO> agencyDistributionResultDTOS = screenCustomerGridDao.selectSubDistribution(compartmentFormDTO.getAgencyId());
agencyAreaInfo.setAgencyDistribution(agencyDistributionResultDTOS);
}else {
List<AgencyDistributionResultDTO> agencyDistributionResultDTOS = screenCustomerAgencyDao.selectSubDistributionByType(compartmentFormDTO.getAgencyId(),compartmentFormDTO.getBizType());
agencyAreaInfo.setAgencyDistribution(agencyDistributionResultDTOS);
}
return agencyAreaInfo;
}
}

30
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java

@ -0,0 +1,30 @@
package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenDifficultyDataDao;
import com.epmet.datareport.service.evaluationindex.screen.ScreenDifficultyDataService;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.project.dto.result.ProjectDetailResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author zxc
* @DateTime 2020/10/23 1:26 下午
*/
@Service
@Slf4j
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenDifficultyDataServiceImpl implements ScreenDifficultyDataService {
@Autowired
private ScreenDifficultyDataDao screenDifficultyDataDao;
@Override
public ProjectDetailResultDTO projectDetail(ProcessListFormDTO processListFormDTO) {
ProjectDetailResultDTO projectDetailResultDTO = screenDifficultyDataDao.projectDetail(processListFormDTO.getProjectId());
return projectDetailResultDTO;
}
}

9
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java

@ -1,6 +1,7 @@
package com.epmet.module.project.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO;
import com.epmet.project.dto.result.*;
@ -41,4 +42,12 @@ public interface ProjectService {
* @Description 数据-项目-/月数据查询
**/
List<ProjectIncrTrendResultDTO> getProjectIncrTrend(TokenDto tokenDto, ProjectIncrTrendFormDTO formDTO);
/**
* @Description 项目详情
* @Param processListFormDTO
* @author zxc
* @date 2020/10/23 10:33 上午
*/
ProjectDetailResultDTO projectDetail( ProcessListFormDTO processListFormDTO);
}

29
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java

@ -4,10 +4,15 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.dao.project.ProjectDao;
import com.epmet.datareport.service.evaluationindex.screen.ScreenDifficultyDataService;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.result.ProcesslistResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovProjectOpenFeignClient;
import com.epmet.module.project.service.ProjectService;
import com.epmet.project.constant.ProjectConstant;
import com.epmet.project.dto.FactAgencyProjectDailyDTO;
@ -35,6 +40,10 @@ public class ProjectServiceImpl implements ProjectService {
private ProjectDao projectDao;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private GovProjectOpenFeignClient govProjectOpenFeignClient;
@Autowired
private ScreenDifficultyDataService screenDifficultyDataService;
/**
* @Author sun
@ -168,6 +177,26 @@ public class ProjectServiceImpl implements ProjectService {
return resultList;
}
/**
* @Description 项目详情
* @Param processListFormDTO
* @author zxc
* @date 2020/10/23 10:33 上午
*/
@Override
public ProjectDetailResultDTO projectDetail(ProcessListFormDTO processListFormDTO) {
ProjectDetailResultDTO projectDetailResultDTO = screenDifficultyDataService.projectDetail(processListFormDTO);
if (null == projectDetailResultDTO){
return new ProjectDetailResultDTO();
}
Result<List<ProcesslistResultDTO>> processList = govProjectOpenFeignClient.getProcessList(processListFormDTO);
if (!processList.success()){
throw new RenException(ProjectConstant.PROCESS_FAILURE);
}
projectDetailResultDTO.setProcessList(processList.getData());
return projectDetailResultDTO;
}
/**
* @author sun
* @Description 获取机关ID

33
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -151,4 +151,37 @@
ca.created_time DESC
</select>
<select id="getAgencyAreaInfoByBizType" resultType="com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO">
SELECT
bo.ORG_ID AS agencyId,
sca.agency_name AS name,
IFNULL(sca.area_marks,'') AS areaMarks,
sca.level AS level
FROM
screen_customer_agency sca
LEFT JOIN screen_customer_biz_org bo ON bo.ORG_ID = sca.AGENCY_ID
WHERE
sca.del_flag = 0
AND bo.DEL_FLAG = 0
AND bo.ORG_ID = #{agencyId}
AND bo.BIZ_TYPE = #{bizType}
</select>
<select id="selectSubDistributionByType" resultType="com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO">
SELECT
ORG_ID AS subId,
sca.agency_name AS subName,
IFNULL(sca.area_marks,'') AS subAreaMarks,
IFNULL(sca.center_mark,'') AS subCenterMark,
'agency' AS type
FROM
screen_customer_agency sca
LEFT JOIN screen_customer_biz_org cbo ON cbo.ORG_ID = sca.AGENCY_ID
WHERE
sca.del_flag = 0
AND cbo.DEL_FLAG = 0
AND cbo.BIZ_TYPE = #{bizType}
AND sca.pid = #{agencyId}
</select>
</mapper>

26
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml

@ -30,4 +30,30 @@
DESC
</select>
<resultMap id="projectDetail" type="com.epmet.project.dto.result.ProjectDetailResultDTO">
<result property="eventContent" column="eventContent"/>
<result property="eventTitle" column="eventTitle"/>
<result property="eventSource" column="eventSource"/>
<collection property="imgUrlList" ofType="java.lang.String">
<constructor>
<arg column="imgUrl"/>
</constructor>
</collection>
</resultMap>
<!-- 项目详情 -->
<select id="projectDetail" resultMap="projectDetail">
SELECT
dd.event_title AS eventTitle,
dd.EVENT_CONTENT AS eventContent,
dd.EVENT_SOURCE AS eventSource,
did.EVENT_IMG_URL AS imgUrl
FROM
screen_difficulty_data dd
LEFT JOIN screen_difficulty_img_data did ON did.EVENT_ID = dd.EVENT_ID
WHERE
dd.DEL_FLAG = '0'
AND did.DEL_FLAG = '0'
AND dd.EVENT_ID = #{eventId}
</select>
</mapper>

4
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java

@ -21,8 +21,8 @@ import java.util.List;
* @author yinzuomei@elink-cn.com
* @date 2020/6/4 10:28
*/
//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class)
@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "localhost:8103")
@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class)
//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "localhost:8103")
public interface EpmetCommonServiceOpenFeignClient {
/**
* @param formDTO

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

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

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

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

4
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java

@ -90,4 +90,8 @@ public class ExtAppJwtTokenUtils {
return createToken(claim, secret);
}
public static void main(String[] args) {
genTestToken();
}
}

7
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/WxMsgTemplateSubscribeStatus.java

@ -0,0 +1,7 @@
package com.epmet.constant;
public interface WxMsgTemplateSubscribeStatus {
//wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
String SUBSCRIBE = "subscribe";
String UNSUBSCRIBE = "unsubscribe";
}

126
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpMsgSendRecordDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 消息发送记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpMsgSendRecordDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 所属端类型 居民端:resi 工作端:work
*/
private String clientType;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* 行为类型(存title字段的中间值) 入组申请党员认证等
*/
private String behaviorType;
/**
* 消息标题 消息标题
*/
private String title;
/**
* 消息内容 消息内容
*/
private String messageContent;
/**
* 消息时间 消息时间
*/
private Date messageTime;
/**
* 发送结果(成功success 失败error)
*/
private String result;
/**
* 发送失败的原因成功可以不记录
*/
private String reason;
/**
* 删除标识
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

101
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpResiUserSubscribeDTO.java

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 居民端用户订阅模板消息次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpResiUserSubscribeDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
/**
* 可用推送次数 可用推送次数
*/
private Integer count;
/**
* 删除标识
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

108
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpTemplateMsgSubscribeStatusDTO.java

@ -0,0 +1,108 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 用户模板消息订阅授权状态表记录我们自己和微信的授权页用户勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpTemplateMsgSubscribeStatusDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 所属端类型 居民端:resi 工作端:work
*/
private String clientType;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* 是否总是访问 :yes :no
*/
private String alwaysVisit;
/**
* 订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String subscribeStatus;
/**
* wx是否总是访问 :yes :no
*/
private String wxAlwaysVisit;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
/**
* 删除标识
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
private Date templateId;
}

106
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpUserSubscribeRecordDTO.java

@ -0,0 +1,106 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 用户触发订阅的行为记录表同时记录微信授权页每次勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpUserSubscribeRecordDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* 行为类型(存title字段的中间值) 入组申请党员认证等
*/
private String behaviorType;
/**
* wx是否总是访问 :yes :no
*/
private String wxAlwaysVisit;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
/**
* 删除标识
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

101
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/WxmpWorkUserSubscribeDTO.java

@ -0,0 +1,101 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 工作端用户订阅模板消息有效次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpWorkUserSubscribeDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
/**
* 可用推送次数 可用推送次数
*/
private Integer count;
/**
* 删除标识
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

31
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/TemplateListFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 获取客户小程序模板列表-接口入参
* @Author sun
*/
@Data
public class TemplateListFormDTO implements Serializable {
/**
* 客户Id
*/
@NotBlank(message="客户Id不能为空", groups = {TemplateListFormDTO.AddUserInternalGroup.class})
private String customerId;
/**
* 小程序Id
*/
@NotBlank(message="小程序appId不能为空", groups = {TemplateListFormDTO.AddUserInternalGroup.class})
private String appId;
/**
* 模板类型(站内信提醒)
*/
private String templateType;
public interface AddUserInternalGroup {}
}

42
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxMsgAuthInfoFormDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class WxMsgAuthInfoFormDTO {
public interface SaveSysAuthInfoGroup {}
public interface GetAuthInfoGroup {}
public interface SaveWxSubscribeInfoGroup {}
@NotBlank(message = "客户id不能为空", groups = { SaveSysAuthInfoGroup.class, GetAuthInfoGroup.class, SaveWxSubscribeInfoGroup.class })
private String customerId;
@NotBlank(message = "客户端类型不能为空", groups = { SaveSysAuthInfoGroup.class, GetAuthInfoGroup.class, SaveWxSubscribeInfoGroup.class })
private String clientType;
@NotBlank(message = "'是否总是允许'选项不能为空", groups = { SaveSysAuthInfoGroup.class })
private String alwaysVisit;
@NotBlank(message = "是否去订阅字段不能为空", groups = { SaveSysAuthInfoGroup.class })
private String subscribeStatus;
@NotBlank(message = "模板ID不能为空", groups = { SaveWxSubscribeInfoGroup.class, GetAuthInfoGroup.class, SaveSysAuthInfoGroup.class })
private String templateId;
@NotBlank(message = "微信'是否总是允许'选项不能为空", groups = { SaveWxSubscribeInfoGroup.class })
private String wxAlwaysVisit;
@NotBlank(message = "微信'是否订阅字段不能为空'", groups = { SaveWxSubscribeInfoGroup.class })
private String wxSubscribeStatus;
@NotBlank(message = "动作类型不能为空", groups = { SaveWxSubscribeInfoGroup.class })
private String behaviorType;
}

57
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxSubscribeMessageFormDTO.java

@ -0,0 +1,57 @@
package com.epmet.dto.form;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @description: 微信订阅消息FormDTO
* @author: liushaowen
* @date: 2020/10/21 14:29
*/
@Data
public class WxSubscribeMessageFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空")
private String customerId;
/**
* 客户端类型 居民端:resi 工作端:work
*/
@NotBlank(message = "客户端类型不能为空")
private String clientType;
/**
* 接收者用户 userId
*/
@NotBlank(message = "接收用户id不能为空")
private String userId;
/**
* 行为类型(存title字段的中间值) 入组申请党员认证等
*/
@NotBlank(message = "行为类型不能为空")
private String behaviorType;
/**
* 消息内容
*/
@NotBlank(message = "消息内容不能为空")
private String messageContent;
/**
* 消息时间
*/
@NotNull(message = "消息时间不能为空")
private Date messageTime;
}

41
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/WxMsgAuthInfoResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.result;
import lombok.Data;
@Data
public class WxMsgAuthInfoResultDTO {
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 所属端类型 居民端:resi 工作端:work
*/
private String clientType;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* 是否总是访问 :yes :no
*/
private String alwaysVisit;
/**
* 订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String subscribeStatus;
/**
* wx是否总是访问 :yes :no
*/
private String wxAlwaysVisit;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
}

10
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.SysSmsDTO;
import com.epmet.dto.form.SendVerificationCodeFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.result.SendVerificationCodeResultDTO;
import com.epmet.feign.fallback.EpmetMessageOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
@ -67,4 +68,13 @@ public interface EpmetMessageOpenFeignClient {
**/
@PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result saveUserMessageList(List<UserMessageFormDTO> msgList);
/**
* @param msgList
* @return com.epmet.commons.tools.utils.Result
* @Author liushaowen
* @Description 发送微信订阅消息
**/
@PostMapping(value = "message/wxmpmessage/sendwxsubscribemessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result sendWxSubscribeMessage(List<WxSubscribeMessageFormDTO> msgList);
}

6
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java

@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.SysSmsDTO;
import com.epmet.dto.form.SendVerificationCodeFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.result.SendVerificationCodeResultDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import org.springframework.stereotype.Component;
@ -45,4 +46,9 @@ public class EpmetMessageOpenFeignClientFallback implements EpmetMessageOpenFeig
public Result saveUserMessageList(List<UserMessageFormDTO> msgList) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList);
}
@Override
public Result sendWxSubscribeMessage(List<WxSubscribeMessageFormDTO> msgList) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendWxSubscribeMessage", msgList);
}
}

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

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-message-server:
container_name: epmet-message-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.29
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.31
ports:
- "8085:8085"
network_mode: host # 使用现有网络

18
epmet-module/epmet-message/epmet-message-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.29</version>
<version>0.3.31</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-message</artifactId>
@ -25,6 +25,11 @@
<artifactId>epmet-message-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-admin-client</artifactId>
@ -96,6 +101,17 @@
<artifactId>flyway-core</artifactId>
<!--<version>5.1.1</version>-->
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

61
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/WxmpMessageConstant.java

@ -0,0 +1,61 @@
package com.epmet.constant;
import java.util.HashMap;
import java.util.Map;
/**
* @description: 微信订阅消息常量
* @author: liushaowen
* @date: 2020/10/21 17:45
*/
public interface WxmpMessageConstant {
String SEND_MESSAGE = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=";
String ERR_CODE = "errcode";
String ERR_MSG = "errmsg";
int USER_REFUSED = 43101;
String AUTHORIZER_ACCESS_TOKEN = "authorizerAccessToken";
String RESI = "resi";
String WORK = "work";
String ACCESS_TOKEN = "access_token";
String TOUSER = "touser";
String TEMPLATE_ID = "template_id";
String PAGE = "page";
String TITLE = "title";
int TITLE_LIMIT = 20;
String MESSAGE_CONTENT = "message_content";
int MESSAGE_CONTENT_LIMIT = 20;
String MESSAGE_TIME = "message_time";
String DATA = "data";
String MINIPROGRAM_STATE = "miniprogram_state";
String SUCCESS = "success";
String ERROR = "error";
String PAGE_RESI = "";
String PAGE_WORK = "";
String STATE_DEV = "developer";
String STATE_TEST = "trial";
}

2
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java

@ -162,4 +162,4 @@ public class UserMessageController {
List<StaffMessageResultDTO> list = userMessageService.queryStaffMessage(formDTO);
return new Result<List<StaffMessageResultDTO>>().ok(list);
}
}
}

127
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java

@ -0,0 +1,127 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.form.WxMsgAuthInfoFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.WxMsgAuthInfoResultDTO;
import com.epmet.service.WxmpMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 微信消息订阅controller
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@RestController
@RequestMapping("wxmpmessage")
public class WxmpMessageController {
@Autowired
private WxmpMessageService wxmpMessageService;
@Autowired
private LoginUserUtil loginUserUtil;
/**
* @Description 保存系统自身的弹框授权信息
* @return com.epmet.commons.tools.utils.Result
* @author wxz
* @date 2020.10.21 17:32
*/
@PostMapping("save-sys-authorizeinfo")
public Result saveSysAuthorizationInfo(@RequestBody WxMsgAuthInfoFormDTO form) {
ValidatorUtils.validateEntity(form, WxMsgAuthInfoFormDTO.SaveSysAuthInfoGroup.class);
String alwaysVisit = form.getAlwaysVisit();
String clientType = form.getClientType();
String customerId = form.getCustomerId();
String subscribeStatus = form.getSubscribeStatus();
String templateId = form.getTemplateId();
wxmpMessageService.saveSysAuthorizeInfo(customerId, clientType, alwaysVisit, subscribeStatus, loginUserUtil.getLoginUserId(), templateId);
return new Result();
}
@PostMapping("sendwxsubscribemessage")
public Result sendWxSubscribeMessage(@RequestBody List<WxSubscribeMessageFormDTO> msgList){
for (WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO : msgList) {
ValidatorUtils.validateEntity(wxSubscribeMessageFormDTO);
}
wxmpMessageService.sendWxSubscribeMessage(msgList);
return new Result();
}
/**
* @return
* @Description 居民端工作端-获取客户小程序模板列表
* @author sun
*/
@PostMapping("templatelist")
public Result<List<GetTemplateListResultDTO>> templateList(@RequestBody GetTemplateListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GetTemplateListFormDTO.AddUserInternalGroup.class);
return new Result<List<GetTemplateListResultDTO>>().ok(wxmpMessageService.templateList(formDTO));
}
/**
* @Description 查询用户授权信息
* @return
* @author wxz
* @date 2020.10.21 18:15
*/
@PostMapping("get-authorizeinfo")
public Result getAuthorizationInfo(@RequestBody WxMsgAuthInfoFormDTO form) {
ValidatorUtils.validateEntity(form, WxMsgAuthInfoFormDTO.GetAuthInfoGroup.class);
WxMsgAuthInfoResultDTO authorizationInfo = wxmpMessageService.getAuthorizationInfo(
form.getCustomerId(), form.getClientType(),
loginUserUtil.getLoginUserId(), form.getTemplateId());
return new Result().ok(authorizationInfo);
}
/**
* 保存微信订阅的授权信息
* @param form
* @return
*/
@PostMapping("save-wxsubscribe")
public Result saveWxSubscribe(@RequestBody WxMsgAuthInfoFormDTO form) {
ValidatorUtils.validateEntity(form, WxMsgAuthInfoFormDTO.SaveWxSubscribeInfoGroup.class);
String customerId = form.getCustomerId();
String clientType = form.getClientType();
String templateId = form.getTemplateId();
String wxAlwaysVisit = form.getWxAlwaysVisit();
String wxSubscribeStatus = form.getWxSubscribeStatus();
String behaviorType = form.getBehaviorType();
wxmpMessageService.saveWxSubscribe(customerId, clientType, templateId, wxAlwaysVisit, wxSubscribeStatus, behaviorType, loginUserUtil.getLoginUserId());
return new Result();
}
}

94
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMsgSendRecordController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.WxmpMsgSendRecordDTO;
import com.epmet.excel.WxmpMsgSendRecordExcel;
import com.epmet.service.WxmpMsgSendRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 消息发送记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@RestController
@RequestMapping("wxmpmsgsendrecord")
public class WxmpMsgSendRecordController {
@Autowired
private WxmpMsgSendRecordService wxmpMsgSendRecordService;
@GetMapping("page")
public Result<PageData<WxmpMsgSendRecordDTO>> page(@RequestParam Map<String, Object> params){
PageData<WxmpMsgSendRecordDTO> page = wxmpMsgSendRecordService.page(params);
return new Result<PageData<WxmpMsgSendRecordDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<WxmpMsgSendRecordDTO> get(@PathVariable("id") String id){
WxmpMsgSendRecordDTO data = wxmpMsgSendRecordService.get(id);
return new Result<WxmpMsgSendRecordDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody WxmpMsgSendRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
wxmpMsgSendRecordService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody WxmpMsgSendRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
wxmpMsgSendRecordService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
wxmpMsgSendRecordService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WxmpMsgSendRecordDTO> list = wxmpMsgSendRecordService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, WxmpMsgSendRecordExcel.class);
}
}

94
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpResiUserSubscribeController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.WxmpResiUserSubscribeDTO;
import com.epmet.excel.WxmpResiUserSubscribeExcel;
import com.epmet.service.WxmpResiUserSubscribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 居民端用户订阅模板消息次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@RestController
@RequestMapping("wxmpresiusersubscribe")
public class WxmpResiUserSubscribeController {
@Autowired
private WxmpResiUserSubscribeService wxmpResiUserSubscribeService;
@GetMapping("page")
public Result<PageData<WxmpResiUserSubscribeDTO>> page(@RequestParam Map<String, Object> params){
PageData<WxmpResiUserSubscribeDTO> page = wxmpResiUserSubscribeService.page(params);
return new Result<PageData<WxmpResiUserSubscribeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<WxmpResiUserSubscribeDTO> get(@PathVariable("id") String id){
WxmpResiUserSubscribeDTO data = wxmpResiUserSubscribeService.get(id);
return new Result<WxmpResiUserSubscribeDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody WxmpResiUserSubscribeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
wxmpResiUserSubscribeService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody WxmpResiUserSubscribeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
wxmpResiUserSubscribeService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
wxmpResiUserSubscribeService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WxmpResiUserSubscribeDTO> list = wxmpResiUserSubscribeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, WxmpResiUserSubscribeExcel.class);
}
}

94
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpTemplateMsgSubscribeStatusController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.WxmpTemplateMsgSubscribeStatusDTO;
import com.epmet.excel.WxmpTemplateMsgSubscribeStatusExcel;
import com.epmet.service.WxmpTemplateMsgSubscribeStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 用户模板消息订阅授权状态表记录我们自己和微信的授权页用户勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@RestController
@RequestMapping("wxmptemplatemsgsubscribestatus")
public class WxmpTemplateMsgSubscribeStatusController {
@Autowired
private WxmpTemplateMsgSubscribeStatusService wxmpTemplateMsgSubscribeStatusService;
@GetMapping("page")
public Result<PageData<WxmpTemplateMsgSubscribeStatusDTO>> page(@RequestParam Map<String, Object> params){
PageData<WxmpTemplateMsgSubscribeStatusDTO> page = wxmpTemplateMsgSubscribeStatusService.page(params);
return new Result<PageData<WxmpTemplateMsgSubscribeStatusDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<WxmpTemplateMsgSubscribeStatusDTO> get(@PathVariable("id") String id){
WxmpTemplateMsgSubscribeStatusDTO data = wxmpTemplateMsgSubscribeStatusService.get(id);
return new Result<WxmpTemplateMsgSubscribeStatusDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody WxmpTemplateMsgSubscribeStatusDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
wxmpTemplateMsgSubscribeStatusService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody WxmpTemplateMsgSubscribeStatusDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
wxmpTemplateMsgSubscribeStatusService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
wxmpTemplateMsgSubscribeStatusService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WxmpTemplateMsgSubscribeStatusDTO> list = wxmpTemplateMsgSubscribeStatusService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, WxmpTemplateMsgSubscribeStatusExcel.class);
}
}

94
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpUserSubscribeRecordController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.WxmpUserSubscribeRecordDTO;
import com.epmet.excel.WxmpUserSubscribeRecordExcel;
import com.epmet.service.WxmpUserSubscribeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 用户触发订阅的行为记录表同时记录微信授权页每次勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@RestController
@RequestMapping("wxmpusersubscriberecord")
public class WxmpUserSubscribeRecordController {
@Autowired
private WxmpUserSubscribeRecordService wxmpUserSubscribeRecordService;
@GetMapping("page")
public Result<PageData<WxmpUserSubscribeRecordDTO>> page(@RequestParam Map<String, Object> params){
PageData<WxmpUserSubscribeRecordDTO> page = wxmpUserSubscribeRecordService.page(params);
return new Result<PageData<WxmpUserSubscribeRecordDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<WxmpUserSubscribeRecordDTO> get(@PathVariable("id") String id){
WxmpUserSubscribeRecordDTO data = wxmpUserSubscribeRecordService.get(id);
return new Result<WxmpUserSubscribeRecordDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody WxmpUserSubscribeRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
wxmpUserSubscribeRecordService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody WxmpUserSubscribeRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
wxmpUserSubscribeRecordService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
wxmpUserSubscribeRecordService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WxmpUserSubscribeRecordDTO> list = wxmpUserSubscribeRecordService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, WxmpUserSubscribeRecordExcel.class);
}
}

94
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpWorkUserSubscribeController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.WxmpWorkUserSubscribeDTO;
import com.epmet.excel.WxmpWorkUserSubscribeExcel;
import com.epmet.service.WxmpWorkUserSubscribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 工作端用户订阅模板消息有效次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@RestController
@RequestMapping("wxmpworkusersubscribe")
public class WxmpWorkUserSubscribeController {
@Autowired
private WxmpWorkUserSubscribeService wxmpWorkUserSubscribeService;
@GetMapping("page")
public Result<PageData<WxmpWorkUserSubscribeDTO>> page(@RequestParam Map<String, Object> params){
PageData<WxmpWorkUserSubscribeDTO> page = wxmpWorkUserSubscribeService.page(params);
return new Result<PageData<WxmpWorkUserSubscribeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<WxmpWorkUserSubscribeDTO> get(@PathVariable("id") String id){
WxmpWorkUserSubscribeDTO data = wxmpWorkUserSubscribeService.get(id);
return new Result<WxmpWorkUserSubscribeDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody WxmpWorkUserSubscribeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
wxmpWorkUserSubscribeService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody WxmpWorkUserSubscribeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
wxmpWorkUserSubscribeService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
wxmpWorkUserSubscribeService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<WxmpWorkUserSubscribeDTO> list = wxmpWorkUserSubscribeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, WxmpWorkUserSubscribeExcel.class);
}
}

34
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpMsgSendRecordDao.java

@ -0,0 +1,34 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.WxmpMsgSendRecordEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 消息发送记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Mapper
public interface WxmpMsgSendRecordDao extends BaseDao<WxmpMsgSendRecordEntity> {
int saveRecord(WxmpMsgSendRecordEntity entity);
}

88
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpResiUserSubscribeDao.java

@ -0,0 +1,88 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.WxmpResiUserSubscribeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 居民端用户订阅模板消息次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Mapper
public interface WxmpResiUserSubscribeDao extends BaseDao<WxmpResiUserSubscribeEntity> {
/**
* @Description 根据openId获取剩余订阅条数
* @param openId
* @param templateId
* @param customerId
* @return java.lang.Integer
* @Author liushaowen
* @Date 2020/10/22 9:30
*/
Integer getResiSubscribeInfo(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId);
/**
* @Description 减少订阅条数
* @param openId
* @param customerId
* @param templateId
* @param i 减少的数量
* @return int
* @Author liushaowen
* @Date 2020/10/22 9:38
*/
int decreaseResiSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId,@Param("num") int i);
/**
* @Description 清空订阅条数修改订阅状态
* @param openId
* @param customerId
* @param templateId
* @return int
* @Author liushaowen
* @Date 2020/10/22 13:23
*/
int clearResiSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId);
/**
* @Description 获取模板id
* @param openId
* @param templateId
* @param customerId
* @return java.lang.Integer
* @Author liushaowen
* @Date 2020/10/23 10:53
*/
String getResiSubscribeTemplateId(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId);
WxmpResiUserSubscribeEntity getWxResiSubscribe(@Param("userId") String userId, @Param("customerId") String customerId,
@Param("templateId") String templateId);
void incrSubscribeCount(@Param("incr") int incr,
@Param("userId") String userId,
@Param("customerId") String customerId,
@Param("templateId")String templateId,
@Param("resiOpenId") String resiOpenId);
void unSubscribe(String userId, String customerId, String templateId, String resiOpenId);
}

44
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpTemplateMsgSubscribeStatusDao.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.WxMsgAuthInfoResultDTO;
import com.epmet.entity.WxmpTemplateMsgSubscribeStatusEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 用户模板消息订阅授权状态表记录我们自己和微信的授权页用户勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Mapper
public interface WxmpTemplateMsgSubscribeStatusDao extends BaseDao<WxmpTemplateMsgSubscribeStatusEntity> {
WxMsgAuthInfoResultDTO getUserSubscribeStatusDTO(@Param("userId") String userId,
@Param("customerId") String customerId,
@Param("clientType") String clientType,
@Param("templateId") String templateId);
WxmpTemplateMsgSubscribeStatusEntity getUserSubscribeStatusEntity(@Param("userId") String userId,
@Param("customerId") String customerId,
@Param("clientType") String clientType,
@Param("templateId") String templateId);
}

33
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpUserSubscribeRecordDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.WxmpUserSubscribeRecordEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 用户触发订阅的行为记录表同时记录微信授权页每次勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Mapper
public interface WxmpUserSubscribeRecordDao extends BaseDao<WxmpUserSubscribeRecordEntity> {
}

90
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/WxmpWorkUserSubscribeDao.java

@ -0,0 +1,90 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.WxmpWorkUserSubscribeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 工作端用户订阅模板消息有效次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Mapper
public interface WxmpWorkUserSubscribeDao extends BaseDao<WxmpWorkUserSubscribeEntity> {
/**
* @Description 根据openId获取剩余订阅条数
* @param openId
* @param templateId
* @param customerId
* @return java.lang.Integer
* @Author liushaowen
* @Date 2020/10/22 9:31
*/
Integer getWorkSubscribeInfo(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId);
/**
* @Description 减少订阅条数
* @param openId
* @param templateId
* @param customerId
* @param i 减少的数量
* @return int
* @Author liushaowen
* @Date 2020/10/22 9:38
*/
int decreaseWorkSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId, @Param("num") int i);
/**
* @Description 清空订阅数修改订阅状态
* @param openId
* @param customerId
* @param templateId
* @return int
* @Author liushaowen
* @Date 2020/10/22 13:22
*/
int clearWorkSubscribeCount(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId);
/**
* @Description 获取模板id
* @param openId
* @param templateId
* @param customerId
* @return java.lang.String
* @Author liushaowen
* @Date 2020/10/23 10:54
*/
String getWorkSubscribeTemplateId(@Param("openId") String openId, @Param("templateId") String templateId, @Param("customerId") String customerId);
WxmpWorkUserSubscribeEntity getWxWorkSubscribe(@Param("userId") String userId,
@Param("customerId") String customerId,
@Param("templateId") String templateId);
void incrSubscribeCount(@Param("incr") int incr,
@Param("userId") String userId,
@Param("customerId") String customerId,
@Param("templateId") String templateId,
@Param("openId") String workOpenId);
void unSubscribe(String userId, String customerId, String templateId, String workOpenId);
}

96
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpMsgSendRecordEntity.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 消息发送记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("wxmp_msg_send_record")
public class WxmpMsgSendRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 所属端类型 居民端:resi 工作端:work
*/
private String clientType;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* 行为类型(存title字段的中间值) 入组申请党员认证等
*/
private String behaviorType;
/**
* 消息标题 消息标题
*/
private String title;
/**
* 消息内容 消息内容
*/
private String messageContent;
/**
* 消息时间 消息时间
*/
private Date messageTime;
/**
* 发送结果(成功success 失败error)
*/
private String result;
/**
* 发送失败的原因成功可以不记录
*/
private String reason;
}

71
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpResiUserSubscribeEntity.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 居民端用户订阅模板消息次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("wxmp_resi_user_subscribe")
public class WxmpResiUserSubscribeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
/**
* 可用推送次数 可用推送次数
*/
private Integer count;
}

79
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpTemplateMsgSubscribeStatusEntity.java

@ -0,0 +1,79 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 用户模板消息订阅授权状态表记录我们自己和微信的授权页用户勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("wxmp_template_msg_subscribe_status")
public class WxmpTemplateMsgSubscribeStatusEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 所属端类型 居民端:resi 工作端:work
*/
private String clientType;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* 是否总是访问 :yes :no
*/
private String alwaysVisit;
/**
* 订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String subscribeStatus;
/**
* wx是否总是访问 :yes :no
*/
private String wxAlwaysVisit;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
/**模板id*/
private String templateId;
}

76
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpUserSubscribeRecordEntity.java

@ -0,0 +1,76 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 用户触发订阅的行为记录表同时记录微信授权页每次勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("wxmp_user_subscribe_record")
public class WxmpUserSubscribeRecordEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* 行为类型(存title字段的中间值) 入组申请党员认证等
*/
private String behaviorType;
/**
* wx是否总是访问 :yes :no
*/
private String wxAlwaysVisit;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
}

71
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/WxmpWorkUserSubscribeEntity.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 工作端用户订阅模板消息有效次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("wxmp_work_user_subscribe")
public class WxmpWorkUserSubscribeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id 客户Id
*/
private String customerId;
/**
* 消息模板Id 消息模板Id
*/
private String templateId;
/**
* 用户Id 用户Id
*/
private String userId;
/**
* openId openId
*/
private String wxOpenId;
/**
* wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)
*/
private String wxSubscribeStatus;
/**
* 可用推送次数 可用推送次数
*/
private Integer count;
}

89
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpMsgSendRecordExcel.java

@ -0,0 +1,89 @@
/**
* 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.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 消息发送记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpMsgSendRecordExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户Id 客户Id")
private String customerId;
@Excel(name = "所属端类型 居民端:resi 工作端:work")
private String clientType;
@Excel(name = "消息模板Id 消息模板Id")
private String templateId;
@Excel(name = "用户Id 用户Id")
private String userId;
@Excel(name = "openId openId")
private String wxOpenId;
@Excel(name = "行为类型(存title字段的中间值) 入组申请、党员认证等")
private String behaviorType;
@Excel(name = "消息标题 消息标题")
private String title;
@Excel(name = "消息内容 消息内容")
private String messageContent;
@Excel(name = "消息时间 消息时间")
private Date messageTime;
@Excel(name = "发送结果")
private String result;
@Excel(name = "发送失败的原因")
private String reason;
@Excel(name = "删除标识")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

74
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpResiUserSubscribeExcel.java

@ -0,0 +1,74 @@
/**
* 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.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 居民端用户订阅模板消息次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpResiUserSubscribeExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户Id 客户Id")
private String customerId;
@Excel(name = "消息模板Id 消息模板Id")
private String templateId;
@Excel(name = "用户Id 用户Id")
private String userId;
@Excel(name = "openId openId")
private String wxOpenId;
@Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)")
private String wxSubscribeStatus;
@Excel(name = "可用推送次数 可用推送次数")
private Integer count;
@Excel(name = "删除标识")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

77
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpTemplateMsgSubscribeStatusExcel.java

@ -0,0 +1,77 @@
/**
* 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.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 用户模板消息订阅授权状态表记录我们自己和微信的授权页用户勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpTemplateMsgSubscribeStatusExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户Id 客户Id")
private String customerId;
@Excel(name = "所属端类型 居民端:resi 工作端:work")
private String clientType;
@Excel(name = "用户Id 用户Id")
private String userId;
@Excel(name = "是否总是访问 是:yes 否:no")
private String alwaysVisit;
@Excel(name = "订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)")
private String subscribeStatus;
@Excel(name = "wx是否总是访问 是:yes 否:no")
private String wxAlwaysVisit;
@Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)")
private String wxSubscribeStatus;
@Excel(name = "删除标识")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

77
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpUserSubscribeRecordExcel.java

@ -0,0 +1,77 @@
/**
* 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.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 用户触发订阅的行为记录表同时记录微信授权页每次勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpUserSubscribeRecordExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户Id 客户Id")
private String customerId;
@Excel(name = "消息模板Id 消息模板Id")
private String templateId;
@Excel(name = "用户Id 用户Id")
private String userId;
@Excel(name = "openId openId")
private String wxOpenId;
@Excel(name = "行为类型(存title字段的中间值) 入组申请、党员认证等")
private String behaviorType;
@Excel(name = "wx是否总是访问 是:yes 否:no")
private String wxAlwaysVisit;
@Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)")
private String wxSubscribeStatus;
@Excel(name = "删除标识")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

74
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/WxmpWorkUserSubscribeExcel.java

@ -0,0 +1,74 @@
/**
* 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.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 工作端用户订阅模板消息有效次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Data
public class WxmpWorkUserSubscribeExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户Id 客户Id")
private String customerId;
@Excel(name = "消息模板Id 消息模板Id")
private String templateId;
@Excel(name = "用户Id 用户Id")
private String userId;
@Excel(name = "openId openId")
private String wxOpenId;
@Excel(name = "wx订阅状态 订阅状态(订阅:subscribe 取消订阅:unsubscribe)")
private String wxSubscribeStatus;
@Excel(name = "可用推送次数 可用推送次数")
private Integer count;
@Excel(name = "删除标识")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

43
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/exception/WxSubscribeException.java

@ -0,0 +1,43 @@
package com.epmet.exception;
/**
* @description:
* @author: liushaowen
* @date: 2020/10/22 11:07
*/
public class WxSubscribeException extends Exception {
private String openId;
private String templateId;
/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public WxSubscribeException(String message, String templateId, String openId) {
super(message);
this.openId = openId;
this.templateId = templateId;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
}

30
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMessageRedis.java

@ -0,0 +1,30 @@
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @description: 微信订阅Redis
* @author: liushaowen
* @date: 2020/10/21 15:28
*/
@Slf4j
@Component
public class WxmpMessageRedis {
@Autowired
private RedisUtils redisUtils;
/**
* @Description 获取刷新
* @param key = epmet:wechartthird:authorizerrefreshtoken:customerId:clientType 前缀+客户ID+客户端类型
* @author zxc
*/
public Map<String,Object> getAuthorizerRefreshToken(String key){
Map<String, Object> result = redisUtils.hGetAll("epmet:wechartthird:authorizerrefreshtoken:" + key);
return result;
}
}

47
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpMsgSendRecordRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 消息发送记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Component
public class WxmpMsgSendRecordRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpResiUserSubscribeRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 居民端用户订阅模板消息次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Component
public class WxmpResiUserSubscribeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpTemplateMsgSubscribeStatusRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 用户模板消息订阅授权状态表记录我们自己和微信的授权页用户勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Component
public class WxmpTemplateMsgSubscribeStatusRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpUserSubscribeRecordRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 用户触发订阅的行为记录表同时记录微信授权页每次勾选的状态
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Component
public class WxmpUserSubscribeRecordRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/redis/WxmpWorkUserSubscribeRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 工作端用户订阅模板消息有效次数记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Component
public class WxmpWorkUserSubscribeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

57
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java

@ -0,0 +1,57 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.WxMsgAuthInfoResultDTO;
import java.util.List;
/**
* 微信消息订阅Service
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
public interface WxmpMessageService {
void saveSysAuthorizeInfo(String customerId, String clientType, String alwaysVisit, String subscribeStatus, String userId, String templateId);
WxMsgAuthInfoResultDTO getAuthorizationInfo(String customerId, String clientType, String loginUserId, String templateId);
void saveWxSubscribe(String customerId, String clientType, String templateId, String wxAlwaysVisit, String wxSubscribeStatus,
String behaviorType, String userId);
/**
* @Description 发送订阅消息
* @param msgList
* @return void
* @Author liushaowen
* @Date 2020/10/21 15:34
*/
void sendWxSubscribeMessage(List<WxSubscribeMessageFormDTO> msgList);
/**
* @return
* @Description 居民端工作端-获取客户小程序模板列表
* @author sun
*/
List<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO);
}

105
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMsgSendRecordService.java

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

95
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpResiUserSubscribeService.java

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

95
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpTemplateMsgSubscribeStatusService.java

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

95
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpUserSubscribeRecordService.java

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

95
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpWorkUserSubscribeService.java

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

473
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java

@ -0,0 +1,473 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.WxMsgTemplateSubscribeStatus;
import com.epmet.constant.WxmpMessageConstant;
import com.epmet.dao.WxmpResiUserSubscribeDao;
import com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao;
import com.epmet.dao.WxmpUserSubscribeRecordDao;
import com.epmet.dao.WxmpWorkUserSubscribeDao;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.form.StaffBasicInfoFormDTO;
import com.epmet.dto.form.UserBasicInfoFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.StaffBasicInfo;
import com.epmet.dto.result.UserBasicInfo;
import com.epmet.dto.result.WxMsgAuthInfoResultDTO;
import com.epmet.entity.*;
import com.epmet.exception.WxSubscribeException;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.WxmpMessageRedis;
import com.epmet.service.WxmpMessageService;
import com.epmet.service.WxmpMsgSendRecordService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 微信消息订阅Service
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-10-21
*/
@Service
public class WxmpMessageServiceImpl implements WxmpMessageService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private WxmpTemplateMsgSubscribeStatusDao msgSubscribeStatusDao;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private WxmpMessageRedis wxmpMessageRedis;
@Resource
private WxmpResiUserSubscribeDao wxmpResiUserSubscribeDao;
@Resource
private WxmpWorkUserSubscribeDao wxmpWorkUserSubscribeDao;
@Autowired
private WxmpMsgSendRecordService wxmpMsgSendRecordService;
@Autowired
private WxmpUserSubscribeRecordDao subscribeRecordDao;
/**
* @Description 保存系统授权信息
* @return void
* @author wxz
* @date 2020.10.21 17:29
*/
@Override
public void saveSysAuthorizeInfo(String customerId, String clientType, String alwaysVisit, String subscribeStatus, String userId, String templateId) {
WxmpTemplateMsgSubscribeStatusEntity userSubscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId);
if (userSubscribeStatusEntity != null) {
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit);
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus);
msgSubscribeStatusDao.updateById(userSubscribeStatusEntity);
return;
}
userSubscribeStatusEntity = new WxmpTemplateMsgSubscribeStatusEntity();
userSubscribeStatusEntity.setCustomerId(customerId);
userSubscribeStatusEntity.setClientType(clientType);
userSubscribeStatusEntity.setTemplateId(templateId);
userSubscribeStatusEntity.setAlwaysVisit(alwaysVisit);
userSubscribeStatusEntity.setSubscribeStatus(subscribeStatus);
userSubscribeStatusEntity.setUserId(userId);
msgSubscribeStatusDao.insert(userSubscribeStatusEntity);
}
/**
* @param msgList
* @return void
* @Description 发送订阅消息
* @Author liushaowen
* @Date 2020/10/21 15:34
*/
@Override
public void sendWxSubscribeMessage(List<WxSubscribeMessageFormDTO> msgList) {
logger.info("待发送订阅消息数量:{}", msgList.size());
int succecssCount = 0;
for (WxSubscribeMessageFormDTO msg : msgList) {
try {
String userId = msg.getUserId();
String clientType = msg.getClientType();
String customerId = msg.getCustomerId();
String templateId = null;
String openId = null;
//通过userId获取openId
try {
if (WxmpMessageConstant.RESI.equals(clientType)) {
UserBasicInfoFormDTO userBasicInfoFormDTO = new UserBasicInfoFormDTO();
userBasicInfoFormDTO.setUserId(userId);
openId = epmetUserOpenFeignClient.getUserBasicInfo(userBasicInfoFormDTO).getData().getOpenId();
} else if (WxmpMessageConstant.WORK.equals(clientType)) {
StaffBasicInfoFormDTO staffBasicInfoFormDTO = new StaffBasicInfoFormDTO();
staffBasicInfoFormDTO.setStaffId(userId);
openId = epmetUserOpenFeignClient.getStaffBasicInfo(staffBasicInfoFormDTO).getData().getOpenId();
} else {
throw new WxSubscribeException("clientType有误", "", openId);
}
} catch (Exception e) {
throw new WxSubscribeException("连接User服务失败", "", "");
}
if (StringUtils.isBlank(openId)) {
throw new WxSubscribeException("openId获取失败", "", "");
}
//获取accessToken
StringBuilder key = new StringBuilder(msg.getCustomerId()).append(":").append(msg.getClientType());
Map<String, Object> authorizerRefreshToken = new HashMap<>();
try {
authorizerRefreshToken = wxmpMessageRedis.getAuthorizerRefreshToken(key.toString());
} catch (Exception e) {
throw new WxSubscribeException("连接缓存服务器失败", "", openId);
}
String accessToken = (String) authorizerRefreshToken.get(WxmpMessageConstant.AUTHORIZER_ACCESS_TOKEN);
if (StringUtils.isBlank(accessToken)) {
throw new WxSubscribeException("accessToken获取失败", "", openId);
}
//获取模板id
if (WxmpMessageConstant.RESI.equals(clientType)) {
templateId = wxmpResiUserSubscribeDao.getResiSubscribeTemplateId(openId, templateId, customerId);
} else if (WxmpMessageConstant.WORK.equals(clientType)) {
templateId = wxmpWorkUserSubscribeDao.getWorkSubscribeTemplateId(openId, templateId, customerId);
}
if (StringUtils.isBlank(templateId)) {
throw new WxSubscribeException("获取模板id失败", "", openId);
}
//判断用户是否有次数
Integer count = null;
if (WxmpMessageConstant.RESI.equals(clientType)) {
count = wxmpResiUserSubscribeDao.getResiSubscribeInfo(openId, templateId, customerId);
} else if (WxmpMessageConstant.WORK.equals(clientType)) {
count = wxmpWorkUserSubscribeDao.getWorkSubscribeInfo(openId, templateId, customerId);
}
if (count == null) {
//用户未订阅
throw new WxSubscribeException("用户未订阅", templateId, openId);
}
if (count == 0) {
throw new WxSubscribeException("用户可用额度不足", templateId, openId);
}
//发送消息
JSONObject jsonObject = new JSONObject();
JSONObject data = new JSONObject();
//必填项
jsonObject.put(WxmpMessageConstant.ACCESS_TOKEN, accessToken);
jsonObject.put(WxmpMessageConstant.TOUSER, openId);
jsonObject.put(WxmpMessageConstant.TEMPLATE_ID, templateId);
data.put(WxmpMessageConstant.TITLE, new JSONObject().put("value", ("您有一条" + msg.getBehaviorType()).substring(0, WxmpMessageConstant.TITLE_LIMIT)));
data.put(WxmpMessageConstant.MESSAGE_CONTENT, new JSONObject().put("value", msg.getMessageContent().substring(0, WxmpMessageConstant.MESSAGE_CONTENT_LIMIT)));
data.put(WxmpMessageConstant.MESSAGE_TIME, new JSONObject().put("value", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(msg.getMessageTime())));
jsonObject.put(WxmpMessageConstant.DATA, data);
EnvEnum envEnum = EnvEnum.getCurrentEnv();
//选填项
if (WxmpMessageConstant.RESI.equals(clientType)) {
jsonObject.put(WxmpMessageConstant.PAGE, WxmpMessageConstant.PAGE_RESI);
} else if (WxmpMessageConstant.WORK.equals(clientType)) {
jsonObject.put(WxmpMessageConstant.PAGE, WxmpMessageConstant.PAGE_WORK);
}
//开发环境
if ("dev".equals(envEnum.getCode())) {
jsonObject.put(WxmpMessageConstant.MINIPROGRAM_STATE, WxmpMessageConstant.STATE_DEV);
}
//测试环境
if ("test".equals(envEnum.getCode())) {
jsonObject.put(WxmpMessageConstant.MINIPROGRAM_STATE, WxmpMessageConstant.STATE_TEST);
}
String resultStr = HttpClientManager.getInstance().sendPostByJSON(WxmpMessageConstant.SEND_MESSAGE + accessToken, JSON.toJSONString(jsonObject)).getData();
Map<String, Object> resultMap = JSON.parseObject(resultStr, Map.class);
Object errcode = resultMap.get(WxmpMessageConstant.ERR_CODE);
if (errcode.equals(NumConstant.ZERO)) {
//发送成功
//订阅条数-1
int decrease = 0;
if (WxmpMessageConstant.RESI.equals(clientType)) {
decrease = wxmpResiUserSubscribeDao.decreaseResiSubscribeCount(openId, templateId, customerId, 1);
} else if (WxmpMessageConstant.WORK.equals(clientType)) {
decrease = wxmpWorkUserSubscribeDao.decreaseWorkSubscribeCount(openId, templateId, customerId, 1);
}
if (decrease == 0) {
logger.error("消息{}发送成功但订阅条数-1失败", JSON.toJSONString(msg));
}
//存表
int saveRes = wxmpMsgSendRecordService.saveRecord(initRecord(msg, templateId, openId, WxmpMessageConstant.SUCCESS));
if (saveRes == 0) {
logger.error("消息{}发送成功但存入记录表失败", JSON.toJSONString(msg));
}
} else {
//发送失败
//用户拒绝,需清空订阅表条数,修改订阅状态
if (errcode.equals(WxmpMessageConstant.USER_REFUSED)) {
int clear = 0;
if (WxmpMessageConstant.RESI.equals(clientType)) {
clear = wxmpResiUserSubscribeDao.clearResiSubscribeCount(openId, templateId, customerId);
} else if (WxmpMessageConstant.WORK.equals(clientType)) {
clear = wxmpWorkUserSubscribeDao.clearWorkSubscribeCount(openId, templateId, customerId);
}
if (clear == 0) {
logger.error("消息{}发送失败且清空订阅条数失败", JSON.toJSONString(msg));
}
}
//抛出错误
throw new WxSubscribeException(String.valueOf(resultMap.get(WxmpMessageConstant.ERR_MSG)),templateId, openId);
}
succecssCount++;
} catch (Exception e) {
String errMsg = e.getMessage();
//ValidateException错误信息为getMsg
// if (StringUtils.isBlank(errMsg) && e instanceof ValidateException) {
// errMsg = ((ValidateException) e).getMsg();
// }
if (e instanceof WxSubscribeException) {
//存表
WxmpMsgSendRecordEntity wxmpMsgSendRecordEntity = initRecord(msg, ((WxSubscribeException) e).getTemplateId(), ((WxSubscribeException) e).getOpenId(), WxmpMessageConstant.ERROR);
wxmpMsgSendRecordEntity.setReason(errMsg);
int saveRes = wxmpMsgSendRecordService.saveRecord(wxmpMsgSendRecordEntity);
if (saveRes == 0) {
logger.error("消息{}发送失败且存入记录表失败", JSON.toJSONString(msg));
}
}
logger.error("消息:{}发送失败,原因是:{}", JSON.toJSONString(msg), errMsg);
continue;
}
}
logger.info("{}条消息中的{}条发送成功", msgList.size(), succecssCount);
}
//初始化记录对象
private WxmpMsgSendRecordEntity initRecord(WxSubscribeMessageFormDTO msg, String templateId, String openId, String status) {
WxmpMsgSendRecordEntity wxmpMsgSendRecordEntity = new WxmpMsgSendRecordEntity();
wxmpMsgSendRecordEntity.setCustomerId(msg.getCustomerId());
wxmpMsgSendRecordEntity.setClientType(msg.getClientType());
wxmpMsgSendRecordEntity.setTemplateId(templateId);
wxmpMsgSendRecordEntity.setUserId(msg.getUserId());
wxmpMsgSendRecordEntity.setWxOpenId(openId);
wxmpMsgSendRecordEntity.setBehaviorType(msg.getBehaviorType());
wxmpMsgSendRecordEntity.setTitle("您有一条" + msg.getBehaviorType());
wxmpMsgSendRecordEntity.setMessageContent(msg.getMessageContent());
wxmpMsgSendRecordEntity.setMessageTime(msg.getMessageTime());
wxmpMsgSendRecordEntity.setResult(status);
return wxmpMsgSendRecordEntity;
}
/**
* @return
* @Description 居民端工作端-获取客户小程序模板列表
* @author sun
*/
@Override
public List<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO) {
GetTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, GetTemplateListFormDTO.class);
String url = "https://epmet-cloud.elinkservice.cn/api/third/personaltemplate/templatelist";
//String url = "http://localhost:8080/api/third/personaltemplate/templatelist";
String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(dto)).getData();
logger.info("ThirdLoginServiceImpl.getUserWeChat:httpclient->url:"+url+",结果->"+data);
JSONObject toResult = JSON.parseObject(data);
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class);
if (null != toResult.get("code")) {
mapToResult.setCode(((Integer) toResult.get("code")).intValue());
}
if (!mapToResult.success()) {
logger.error("调用epmet_third服务获取小程序消息订阅模板数据失败");
throw new RenException(mapToResult.getCode());
}
List<GetTemplateListResultDTO> resultList = (List<GetTemplateListResultDTO>) mapToResult.getData();
return resultList;
}
@Override
public WxMsgAuthInfoResultDTO getAuthorizationInfo(String customerId, String clientType, String loginUserId, String templateId) {
return msgSubscribeStatusDao.getUserSubscribeStatusDTO(loginUserId, customerId, clientType, templateId);
}
@Override
public void saveWxSubscribe(String customerId, String clientType, String templateId, String wxAlwaysVisit,
String wxSubscribeStatus, String behaviorType, String userId) {
String openId;
// 1. 用户订阅信息表新增或者更新
if (AppClientConstant.APP_GOV.equals(clientType)) {
// 工作端
openId = getWorkOpenId(userId);
saveWxWorkSubscribe(customerId, templateId, wxSubscribeStatus, userId, openId);
} else {
//居民端
openId = getResiOpenId(userId);
saveWxResiSubscribe(customerId, templateId, wxSubscribeStatus, userId, openId);
}
// 2.保存行为记录
WxmpUserSubscribeRecordEntity record = new WxmpUserSubscribeRecordEntity();
record.setBehaviorType(behaviorType);
record.setCustomerId(customerId);
record.setTemplateId(templateId);
record.setUserId(userId);
record.setWxAlwaysVisit(wxAlwaysVisit);
record.setWxOpenId(openId);
record.setWxSubscribeStatus(wxSubscribeStatus);
subscribeRecordDao.insert(record);
// 3.更新用户模板订阅状态
WxmpTemplateMsgSubscribeStatusEntity subscribeStatusEntity = msgSubscribeStatusDao.getUserSubscribeStatusEntity(userId, customerId, clientType, templateId);
if (subscribeStatusEntity == null) {
subscribeStatusEntity = new WxmpTemplateMsgSubscribeStatusEntity();
subscribeStatusEntity.setUserId(userId);
subscribeStatusEntity.setWxSubscribeStatus(wxSubscribeStatus);
subscribeStatusEntity.setTemplateId(templateId);
subscribeStatusEntity.setWxAlwaysVisit(wxAlwaysVisit);
subscribeStatusEntity.setCustomerId(customerId);
subscribeStatusEntity.setClientType(clientType);
msgSubscribeStatusDao.insert(subscribeStatusEntity);
return;
}
subscribeStatusEntity.setWxAlwaysVisit(wxAlwaysVisit);
subscribeStatusEntity.setWxSubscribeStatus(wxSubscribeStatus);
msgSubscribeStatusDao.updateById(subscribeStatusEntity);
}
/**
* @Description 保存居民端微信订阅信息
* @return void
* @author wxz
* @date 2020.10.22 09:56
*/
private void saveWxResiSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, String openId) {
WxmpResiUserSubscribeEntity wxResiSubscribe = wxmpResiUserSubscribeDao.getWxResiSubscribe(userId, customerId, templateId);
if (wxResiSubscribe == null) {
WxmpResiUserSubscribeEntity insert = new WxmpResiUserSubscribeEntity();
insert.setCount(WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus) ? 1 : 0);
insert.setCustomerId(customerId);
insert.setTemplateId(templateId);
insert.setUserId(userId);
insert.setWxOpenId(openId);
insert.setWxSubscribeStatus(wxSubscribeStatus);
return;
}
if (WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus)) {
wxmpResiUserSubscribeDao.incrSubscribeCount(1, userId, customerId, templateId, openId);
} else {
wxmpResiUserSubscribeDao.unSubscribe(userId, customerId, templateId, openId);
}
}
/**
* @Description 保存工作端订阅信息
* @return void
* @author wxz
* @date 2020.10.22 14:21
*/
private void saveWxWorkSubscribe(String customerId, String templateId, String wxSubscribeStatus, String userId, String openId) {
WxmpWorkUserSubscribeEntity wxWorkSubscribe = wxmpWorkUserSubscribeDao.getWxWorkSubscribe(userId, customerId, templateId);
if (wxWorkSubscribe == null) {
WxmpWorkUserSubscribeEntity insert = new WxmpWorkUserSubscribeEntity();
insert.setCount(WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus) ? 1 : 0);
insert.setCustomerId(customerId);
insert.setTemplateId(templateId);
insert.setUserId(userId);
insert.setWxOpenId(openId);
insert.setWxSubscribeStatus(wxSubscribeStatus);
wxmpWorkUserSubscribeDao.insert(insert);
return ;
}
if (WxMsgTemplateSubscribeStatus.SUBSCRIBE.equals(wxSubscribeStatus)) {
wxmpWorkUserSubscribeDao.incrSubscribeCount(1, userId, customerId, templateId, openId);
} else {
wxmpWorkUserSubscribeDao.unSubscribe(userId, customerId, templateId, openId);
}
}
/**
* @Description 根据UserId查询居民OpenId
* @return string
* @author wxz
* @date 2020.10.22 13:35
*/
public String getResiOpenId(String userId) {
UserBasicInfoFormDTO bif = new UserBasicInfoFormDTO();
bif.setUserId(userId);
Result<UserBasicInfo> result = epmetUserOpenFeignClient.getUserBasicInfo(bif);
if (!result.success()) {
throw new RenException(String.format("查询居民OpenId失败,userId:%s,错误信息:%s",userId , result.getInternalMsg()));
}
UserBasicInfo userBasicInfo = result.getData();
if (userBasicInfo == null) {
throw new RenException(String.format("根据userId:%s,没有查询到居民OpenId",userId));
}
return userBasicInfo.getOpenId();
}
/**
* @Description 查询工作人员openId
* @return java.lang.String
* @author wxz
* @date 2020.10.22 14:46
*/
public String getWorkOpenId(String userId) {
StaffBasicInfoFormDTO form = new StaffBasicInfoFormDTO();
form.setStaffId(userId);
Result<StaffBasicInfo> result = epmetUserOpenFeignClient.getStaffBasicInfo(form);
if (!result.success()) {
throw new RenException(String.format("查询工作人员OpenId失败,userId:%s,错误信息:%s",userId , result.getInternalMsg()));
}
StaffBasicInfo staffBasicInfo = result.getData();
if (staffBasicInfo == null) {
throw new RenException(String.format("根据userId:%s,没有查询到工作人员OpenId",userId));
}
return staffBasicInfo.getOpenId();
}
}

109
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMsgSendRecordServiceImpl.java

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

104
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpResiUserSubscribeServiceImpl.java

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

104
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpTemplateMsgSubscribeStatusServiceImpl.java

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

104
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpUserSubscribeRecordServiceImpl.java

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

104
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpWorkUserSubscribeServiceImpl.java

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

48
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpMsgSendRecordDao.xml

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.WxmpMsgSendRecordDao">
<insert id="saveRecord" parameterType="com.epmet.entity.WxmpMsgSendRecordEntity">
insert into wxmp_msg_send_record
(id,
customer_id,
client_type,
template_id,
user_id,
wx_open_id,
behavior_type,
title,
message_content,
message_time,
result,
reason,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time)
values
(MD5(replace(UUID(),'-','')),
#{customerId},
#{clientType},
#{templateId},
#{userId},
#{wxOpenId},
#{behaviorType},
#{title},
#{messageContent},
#{messageTime},
#{result},
#{reason},
0,
0,
'sys',
now(),
'sys',
now()
)
</insert>
</mapper>

95
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpResiUserSubscribeDao.xml

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.WxmpResiUserSubscribeDao">
<select id="getResiSubscribeInfo" parameterType="String" resultType="java.lang.Integer">
select
count
from Wxmp_Resi_User_Subscribe
where
del_flag = 0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
</select>
<update id="decreaseResiSubscribeCount">
update Wxmp_Resi_User_Subscribe
set count = if(count <![CDATA[<]]> 1, 0, count - ${num} )
where
del_flag = 0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
</update>
<update id="clearResiSubscribeCount" parameterType="String">
update Wxmp_Resi_User_Subscribe
set count = 0,
wx_subscribe_status = 'unsubscribe'
where
del_flag = 0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
</update>
<select id="getResiSubscribeTemplateId" resultType="String">
select
template_id
from Wxmp_Resi_User_Subscribe
where
del_flag = 0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
limit 1
</select>
<!--增加订阅次数-->
<update id="incrSubscribeCount">
update wxmp_resi_user_subscribe
set COUNT=COUNT + #{incr},
WX_SUBSCRIBE_STATUS = 'subscribe'
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{resiOpenId}
</update>
<!--取消订阅-->
<update id="unSubscribe">
update wxmp_resi_user_subscribe
set WX_SUBSCRIBE_STATUS = 'unsubscribe',
COUNT = 0
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{resiOpenId}
</update>
<select id="getWxResiSubscribe" resultType="com.epmet.entity.WxmpResiUserSubscribeEntity">
select id,
customer_id,
template_id,
user_id,
wx_open_id,
wx_subscribe_status,
count,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from wxmp_resi_user_subscribe
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
</select>
</mapper>

49
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpTemplateMsgSubscribeStatusDao.xml

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.WxmpTemplateMsgSubscribeStatusDao">
<select id="getUserSubscribeStatusDTO" resultType="com.epmet.dto.result.WxMsgAuthInfoResultDTO">
select id,
customer_id,
client_type,
user_id,
always_visit,
subscribe_status,
wx_always_visit,
wx_subscribe_status,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from wxmp_template_msg_subscribe_status status
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and CLIENT_TYPE = #{clientType}
and TEMPLATE_ID = #{templateId}
</select>
<select id="getUserSubscribeStatusEntity" resultType="com.epmet.entity.WxmpTemplateMsgSubscribeStatusEntity">
select id,
customer_id,
client_type,
user_id,
always_visit,
subscribe_status,
wx_always_visit,
wx_subscribe_status,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from wxmp_template_msg_subscribe_status status
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and CLIENT_TYPE = #{clientType}
and TEMPLATE_ID = #{templateId}
</select>
</mapper>

8
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpUserSubscribeRecordDao.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.WxmpUserSubscribeRecordDao">
</mapper>

88
epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/WxmpWorkUserSubscribeDao.xml

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.WxmpWorkUserSubscribeDao">
<update id="incrSubscribeCount">
update wxmp_work_user_subscribe
set COUNT=COUNT + #{incr},
WX_SUBSCRIBE_STATUS = 'subscribe'
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{openId}
</update>
<select id="getWorkSubscribeInfo" parameterType="String" resultType="Integer">
select
`count`
from Wxmp_Work_User_Subscribe
where
del_flag =0
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
</select>
<update id="decreaseWorkSubscribeCount">
update Wxmp_Work_User_Subscribe
set count = if(count &lt; 1, 0, count - ${num} )
where
del_flag =0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
</update>
<update id="clearWorkSubscribeCount" parameterType="String">
update Wxmp_Work_User_Subscribe
set count = 0,
wx_subscribe_status = 'unsubscribe'
where
del_flag =0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
</update>
<select id="getWorkSubscribeTemplateId" resultType="String">
select
template_id
from Wxmp_Work_User_Subscribe
where
del_flag = 0
and customer_id = #{customerId}
and template_id = #{templateId}
and wx_open_id = #{openId}
and wx_subscribe_status = 'subscribe'
limit 1
</select>
<update id="unSubscribe">
update wxmp_work_user_subscribe
set WX_SUBSCRIBE_STATUS = 'unsubscribe',
COUNT = 0
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
and WX_OPEN_ID = #{resiOpenId}
</update>
<select id="getWxWorkSubscribe" resultType="com.epmet.entity.WxmpWorkUserSubscribeEntity">
select id,
customer_id,
template_id,
user_id,
wx_open_id,
wx_subscribe_status,
count,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from wxmp_work_user_subscribe
where USER_ID = #{userId}
and CUSTOMER_ID = #{customerId}
and TEMPLATE_ID = #{templateId}
</select>
</mapper>

31
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 获取客户小程序模板列表-接口入参
* @Author sun
*/
@Data
public class GetTemplateListFormDTO implements Serializable {
/**
* 客户Id
*/
@NotBlank(message="客户Id不能为空", groups = {AddUserInternalGroup.class})
private String customerId;
/**
* 小程序Id
*/
@NotBlank(message="小程序appId不能为空", groups = {AddUserInternalGroup.class})
private String appId;
/**
* 模板类型(站内信提醒)
*/
private String templateType;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,25 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 获取客户小程序模板列表-接口返参
* @Author sun
*/
@Data
public class GetTemplateListResultDTO implements Serializable {
private static final long serialVersionUID = 6856602932571839314L;
/**
* 模板Id
*/
private String templateId;
/**
* 模板类型站内信提醒
*/
private String templateType;
}

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

@ -0,0 +1,37 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.service.PersonalTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-09
*/
@RestController
@RequestMapping("personaltemplate")
public class PersonalTemplateController {
@Autowired
private PersonalTemplateService personalTemplateService;
/**
* @return
* @Description 居民端工作端-获取客户小程序模板列表
* @author sun
*/
@PostMapping("templatelist")
public Result<List<GetTemplateListResultDTO>> templateList(@RequestBody GetTemplateListFormDTO formDTO) {
return new Result<List<GetTemplateListResultDTO>>().ok(personalTemplateService.templateList(formDTO));
}
}

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

@ -19,7 +19,9 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PersonalTemplateDTO;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.result.CustomerTempResultDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.TemplateDTO;
import com.epmet.entity.PersonalTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
@ -76,4 +78,11 @@ public interface PersonalTemplateDao extends BaseDao<PersonalTemplateEntity> {
*/
List<TemplateDTO> selectListByCustomerId(@Param("appId") String appId, @Param("customerId") String customerId,
@Param("clientType") String clientType);
/**
* @return
* @Description 居民端工作端-获取客户小程序模板列表
* @author sun
*/
List<GetTemplateListResultDTO> selectTemplateList(GetTemplateListFormDTO formDTO);
}

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

@ -20,6 +20,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PersonalTemplateDTO;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.TemplateDTO;
import com.epmet.entity.PersonalTemplateEntity;
@ -123,4 +125,11 @@ public interface PersonalTemplateService extends BaseService<PersonalTemplateEnt
* @date 2020/9/11 14:43
*/
List<TemplateDTO> getListByCustomer(String appId, String customerId, String clientType);
/**
* @return
* @Description 居民端工作端-获取客户小程序模板列表
* @author sun
*/
List<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO);
}

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

@ -25,6 +25,8 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.PersonalTemplateDao;
import com.epmet.dto.PersonalTemplateDTO;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.TemplateDTO;
import com.epmet.entity.PersonalTemplateEntity;
import com.epmet.service.PersonalTemplateService;
@ -116,4 +118,15 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl<PersonalTemplat
return baseDao.selectListByCustomerId(appId, customerId, clientType);
}
/**
* @return
* @Description 居民端工作端-获取客户小程序模板列表
* @author sun
*/
@Override
public List<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO) {
//根据客户Id、appId、模板类型查询小程序订阅消息模板列表
return baseDao.selectTemplateList(formDTO);
}
}

13
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml

@ -75,5 +75,18 @@
ON t1.PRI_TMPL_ID = t2.PID
</select>
<select id="selectTemplateList" resultType="com.epmet.dto.result.GetTemplateListResultDTO">
SELECT
title AS "templateType",
pri_tmpl_id AS "templateId"
FROM
personal_template
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND app_id = #{appId}
AND title = #{templateType}
ORDER BY CREATED_TIME DESC
</select>
</mapper>

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/GovProjectOpenFeignClient.java

@ -1,8 +1,10 @@
package com.epmet.feign;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.ProjectListFromDTO;
import com.epmet.dto.result.PendProjectListResultDTO;
import com.epmet.dto.result.ProcesslistResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import com.epmet.commons.tools.constant.ServiceConstant;
@ -29,4 +31,7 @@ public interface GovProjectOpenFeignClient {
*/
@PostMapping("gov/project/project/pendprojectlist")
Result<List<PendProjectListResultDTO>> getPendProjectList(@RequestBody ProjectListFromDTO fromDTO);
@PostMapping("gov/project/trace/processlistnotrule")
Result<List<ProcesslistResultDTO>> getProcessList(@RequestBody ProcessListFormDTO fromDTO);
}

7
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/feign/fallback/GovProjectOpenFeignClientFallback.java

@ -3,8 +3,10 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.ProjectListFromDTO;
import com.epmet.dto.result.PendProjectListResultDTO;
import com.epmet.dto.result.ProcesslistResultDTO;
import com.epmet.feign.GovProjectOpenFeignClient;
import org.springframework.stereotype.Component;
@ -22,4 +24,9 @@ public class GovProjectOpenFeignClientFallback implements GovProjectOpenFeignCli
public Result<List<PendProjectListResultDTO>> getPendProjectList(ProjectListFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "getPendProjectList", fromDTO);
}
@Override
public Result<List<ProcesslistResultDTO>> getProcessList(ProcessListFormDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_PROJECT_SERVER, "getProcessList", fromDTO);
}
}

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

Loading…
Cancel
Save