Browse Source

Merge branch 'dev'

master
sunyuchao 5 years ago
parent
commit
b7a61b772d
  1. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  2. 9
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/PageFormDTO.java
  3. 34
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/issue/KcPartiTrendResultDTO.java
  4. 23
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java
  5. 87
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfactionResultDTO.java
  6. 13
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/UserSummaryResultDTO.java
  7. 20
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPointRankResultDTO.java
  8. 29
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPortrayalResultDTO.java
  9. 19
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserRankResultDTO.java
  10. 63
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserTrendResultDTO.java
  11. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsCountResultDTO.java
  12. 26
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsRankResultDTO.java
  13. 12
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsHotRankResultDTO.java
  14. 37
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsPartiTrendResultDTO.java
  15. 14
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsSummaryResultDTO.java
  16. 138
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java
  17. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java
  18. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsCategoryAnalysisDao.java
  19. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsRankDao.java
  20. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsSummaryDailyDao.java
  21. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsTrendMonthlyDao.java
  22. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSatisGridMonthlyDao.java
  23. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserSummaryDailyDao.java
  24. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserTrendGridMonthlyDao.java
  25. 23
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/KcScreenService.java
  26. 144
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/KcScreenServiceImpl.java
  27. 9
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml
  28. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcIssueSummaryGridDailyDao.xml
  29. 30
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml
  30. 16
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml
  31. 18
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml
  32. 11
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml
  33. 17
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml
  34. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml
  35. 56
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml
  36. 13
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml
  37. 51
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java
  38. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  39. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  40. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  41. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java
  42. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  43. 28
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java
  44. 17
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java
  45. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/AuthorizationInfoDTO.java
  46. 126
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PersonalTemplateDTO.java
  47. 91
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PublicTemplateDTO.java
  48. 51
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java
  49. 17
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelTemplateFormDTO.java
  50. 39
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java
  51. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PubTemplateFormDTO.java
  52. 19
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubscribeFormDTO.java
  53. 18
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTempResultDTO.java
  54. 47
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GetTemplateResultDTO.java
  55. 34
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/KeyWordsResultDTO.java
  56. 39
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/PubTemplateResultDTO.java
  57. 17
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SubscribeCategoryResultDTO.java
  58. 31
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java
  59. 149
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java
  60. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java
  61. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PaCustomerDao.java
  62. 79
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java
  63. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PublicTemplateDao.java
  64. 96
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PersonalTemplateEntity.java
  65. 61
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PublicTemplateEntity.java
  66. 9
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java
  67. 126
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java
  68. 115
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PublicTemplateService.java
  69. 105
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java
  70. 25
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java
  71. 5
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java
  72. 119
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java
  73. 112
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PublicTemplateServiceImpl.java
  74. 445
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java
  75. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxSubscribeConstant.java
  76. 20
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java
  77. 31
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxAddTemplateReq.java
  78. 22
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxDelTemplateReq.java
  79. 16
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java
  80. 30
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxSubTemplateReq.java
  81. 41
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxGetCategoryResult.java
  82. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxGetTemplateResult.java
  83. 52
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxKeyWordsResult.java
  84. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxSubTemplateResult.java
  85. 78
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaSubscribeService.java
  86. 146
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaSubscribeServiceImpl.java
  87. 36
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.10__thirdUpdate.sql
  88. 11
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml
  89. 12
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PaCustomerDao.xml
  90. 79
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml
  91. 41
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PublicTemplateDao.xml

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

@ -442,7 +442,7 @@ epmet:
urlWhiteList:
- /data/report/test/test
- /data/report/screen/**
- /data/report/screenkc/**
- /data/report/kcscreen/**
- /epmetuser/customerstaff/customerlist
swaggerUrls:

9
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/PageFormDTO.java

@ -0,0 +1,9 @@
package com.epmet.dto;
import lombok.Data;
@Data
public class PageFormDTO {
private Integer pageNo = 1;
private Integer pageSize = 10;
}

34
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/issue/KcPartiTrendResultDTO.java

@ -1,11 +1,9 @@
package com.epmet.dto.result.issue;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class KcPartiTrendResultDTO {
private String monthId;
@ -13,4 +11,36 @@ public class KcPartiTrendResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> reportCountDataList = new ArrayList<>();
public String getMonthId() {
return monthId;
}
public void setMonthId(String monthId) {
this.monthId = monthId;
}
public Integer getReportCount() {
return reportCount;
}
public void setReportCount(Integer reportCount) {
this.reportCount = reportCount;
}
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getReportCountDataList() {
return reportCountDataList;
}
public void setReportCountDataList(List<Integer> reportCountDataList) {
this.reportCountDataList = reportCountDataList;
}
}

23
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfaction.java

@ -1,23 +0,0 @@
package com.epmet.dto.result.project;
import lombok.Data;
import java.util.List;
@Data
public class ProjectSatisfaction {
private List<String> xAxis;
private List<Integer> greatSatisDataList;
private List<Integer> goodStatisDataList;
private List<Integer> disStatisDataList;
private String monthId;
private String monthName;
// 满意
private Integer goodSatis;
// 非常满意
private Integer greatSatis;
// 不满意
private Integer disSatis;
}

87
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/ProjectSatisfactionResultDTO.java

@ -0,0 +1,87 @@
package com.epmet.dto.result.project;
import java.util.ArrayList;
import java.util.List;
/**
* xAxis 被lombok生成后是XAxis与nei不符所以使用手动生成getter/setter方法
*/
public class ProjectSatisfactionResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> greatSatisDataList = new ArrayList<>();
private List<Integer> goodSatisDataList = new ArrayList<>();
private List<Integer> disSatisDataList = new ArrayList<>();
private String monthId;
// 满意
private Integer goodSatis;
// 非常满意
private Integer greatSatis;
// 不满意
private Integer disSatis;
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getGreatSatisDataList() {
return greatSatisDataList;
}
public void setGreatSatisDataList(List<Integer> greatSatisDataList) {
this.greatSatisDataList = greatSatisDataList;
}
public List<Integer> getGoodSatisDataList() {
return goodSatisDataList;
}
public void setGoodSatisDataList(List<Integer> goodSatisDataList) {
this.goodSatisDataList = goodSatisDataList;
}
public List<Integer> getDisSatisDataList() {
return disSatisDataList;
}
public void setDisSatisDataList(List<Integer> disSatisDataList) {
this.disSatisDataList = disSatisDataList;
}
public String getMonthId() {
return monthId;
}
public void setMonthId(String monthId) {
this.monthId = monthId;
}
public Integer getGoodSatis() {
return goodSatis;
}
public void setGoodSatis(Integer goodSatis) {
this.goodSatis = goodSatis;
}
public Integer getGreatSatis() {
return greatSatis;
}
public void setGreatSatis(Integer greatSatis) {
this.greatSatis = greatSatis;
}
public Integer getDisSatis() {
return disSatis;
}
public void setDisSatis(Integer disSatis) {
this.disSatis = disSatis;
}
}

13
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/project/UserSummaryResultDTO.java

@ -0,0 +1,13 @@
package com.epmet.dto.result.project;
import lombok.Data;
@Data
public class UserSummaryResultDTO {
private String dateId;
private Integer vistorCount;
private Integer regUserCount;
private Integer partyUserCount;
}

20
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPointRankResultDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.result.user;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class KcUserPointRankResultDTO {
private List<String> userNameDataList = new ArrayList<>();
private List<Integer> pointsDataList = new ArrayList<>();
@Data
public static class KcUserPoint {
private String userId;
private String userName;
private Integer pointTotal;
}
}

29
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserPortrayalResultDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class KcUserPortrayalResultDTO {
// 年龄分布
private AgeDistribution ageDistribution;
// 性别分布
private GenderDistribution genderDistribution;
@Data
public static class AgeDistribution {
private Integer ageLevel1;
private Integer ageLevel2;
private Integer ageLevel3;
private Integer ageLevel4;
private Integer ageLevel5;
private Integer ageLevel6;
}
@Data
public static class GenderDistribution {
private Integer malePartyUserCount;
private Integer femalePartyUserCount;
}
}

19
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserRankResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result.user;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class KcUserRankResultDTO {
// 网格名称
private String gridName;
// 浏览用户数
private Integer viewUserCount;
private List<String> gridNameDataList = new ArrayList<>();
private List<Integer> totalUserDataList = new ArrayList<>();
}

63
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/KcUserTrendResultDTO.java

@ -0,0 +1,63 @@
package com.epmet.dto.result.user;
import java.util.ArrayList;
import java.util.List;
public class KcUserTrendResultDTO {
private String monthId;
private Integer regUserCount;
private Integer partyUserCount;
private List<String> xAxis = new ArrayList<>();
private List<Integer> userDataList = new ArrayList<>();
private List<Integer> partyUserDataList = new ArrayList<>();
public String getMonthId() {
return monthId;
}
public void setMonthId(String monthId) {
this.monthId = monthId;
}
public Integer getRegUserCount() {
return regUserCount;
}
public void setRegUserCount(Integer regUserCount) {
this.regUserCount = regUserCount;
}
public Integer getPartyUserCount() {
return partyUserCount;
}
public void setPartyUserCount(Integer partyUserCount) {
this.partyUserCount = partyUserCount;
}
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getUserDataList() {
return userDataList;
}
public void setUserDataList(List<Integer> userDataList) {
this.userDataList = userDataList;
}
public List<Integer> getPartyUserDataList() {
return partyUserDataList;
}
public void setPartyUserDataList(List<Integer> partyUserDataList) {
this.partyUserDataList = partyUserDataList;
}
}

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsCountResultDTO.java

@ -0,0 +1,12 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class ScreenKcCategoryNewsCountResultDTO {
private String categoryName;
private Integer newsCount;
private Integer partiCount;
}

26
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcCategoryNewsRankResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result.user;
import java.util.ArrayList;
import java.util.List;
public class ScreenKcCategoryNewsRankResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> partiCountDataList = new ArrayList<>();
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getPartiCountDataList() {
return partiCountDataList;
}
public void setPartiCountDataList(List<Integer> partiCountDataList) {
this.partiCountDataList = partiCountDataList;
}
}

12
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsHotRankResultDTO.java

@ -0,0 +1,12 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class ScreenKcNewsHotRankResultDTO {
private String newsId;
private String newsTitle;
private Integer hotCount;
}

37
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsPartiTrendResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dto.result.user;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
public class ScreenKcNewsPartiTrendResultDTO {
private List<String> xAxis = new ArrayList<>();
private List<Integer> partiCountDataList = new ArrayList<>();
@Data
public static class ScreenKcNewsPartyCount {
private String monthId;
private Integer partiCount;
}
public List<String> getxAxis() {
return xAxis;
}
public void setxAxis(List<String> xAxis) {
this.xAxis = xAxis;
}
public List<Integer> getPartiCountDataList() {
return partiCountDataList;
}
public void setPartiCountDataList(List<Integer> partiCountDataList) {
this.partiCountDataList = partiCountDataList;
}
}

14
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/user/ScreenKcNewsSummaryResultDTO.java

@ -0,0 +1,14 @@
package com.epmet.dto.result.user;
import lombok.Data;
@Data
public class ScreenKcNewsSummaryResultDTO {
private String dateId;
private Integer newsCount;
private Integer readCount;
private Integer likeCount;
private Integer commentCount;
}

138
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/KcScreenController.java

@ -5,8 +5,9 @@ import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.KcScreenService;
import com.epmet.dto.result.issue.IssueGridTotalRankDTO;
import com.epmet.dto.PageFormDTO;
import com.epmet.dto.result.project.*;
import com.epmet.dto.result.user.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -97,7 +98,7 @@ public class KcScreenController {
}
/**
* 按照议题数排名
* 按照议题数排名
* @param externalAppRequestParam
* @return
*/
@ -123,7 +124,7 @@ public class KcScreenController {
}
/**
* 议题分析-审核效率
* 议题分析-议题效率
* @param externalAppRequestParam
* @return
*/
@ -277,14 +278,135 @@ public class KcScreenController {
* @param externalAppRequestParam
* @return
*/
//@ExternalAppRequestAuth
@ExternalAppRequestAuth
@PostMapping("project/statis")
public Result<ProjectSatisfaction> getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){
String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
//String customerId = externalAppRequestParam.getCustomerId();
return new Result<ProjectSatisfaction>().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId));
public Result<ProjectSatisfactionResultDTO> getProjectSatisfactionAnalyze(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ProjectSatisfactionResultDTO>().ok(kcScreenService.getProjectSatisfactionAnalyze(customerId));
}
/**
* 用户-summary
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/summary")
public Result<UserSummaryResultDTO> getUserSummary(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
//String customerId = "2fe0065f70ca0e23ce4c26fca5f1d933";
return new Result<UserSummaryResultDTO>().ok(kcScreenService.getUserSummary(customerId));
}
/**
* 用户量趋势
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/trend")
public Result<KcUserTrendResultDTO> getUserTrend(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserTrendResultDTO>().ok(kcScreenService.getUserTrend(customerId));
}
/**
* 网格用户数量排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/griduserrank")
public Result<KcUserRankResultDTO> getUserRank(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserRankResultDTO>().ok(kcScreenService.getUserRank(customerId));
}
/**
* 用户画像
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/userportrayal")
public Result<KcUserPortrayalResultDTO> getUserPortrayal(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserPortrayalResultDTO>().ok(kcScreenService.getUserPortrayal(customerId));
}
/**
* 用户积分排名
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("user/pointsrank")
public Result<KcUserPointRankResultDTO> getUserPointsRank(ExternalAppRequestParam externalAppRequestParam,
@RequestBody PageFormDTO form) {
String customerId = externalAppRequestParam.getCustomerId();
return new Result<KcUserPointRankResultDTO>().ok(kcScreenService.getUserPointsRank(customerId, form.getPageNo(), form.getPageSize()));
}
/**
* 党建声音-各类总数
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/summary")
public Result<ScreenKcNewsSummaryResultDTO> getNewsSummary(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ScreenKcNewsSummaryResultDTO>().ok(kcScreenService.getNewsSummary(customerId));
}
/**
* 新闻阅读参与趋势
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/partitrend")
public Result<ScreenKcNewsPartiTrendResultDTO> getNewsPartiTrend(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ScreenKcNewsPartiTrendResultDTO>().ok(kcScreenService.getNewsPartiTrend(customerId));
}
/**
* 党建声音-分类的news数量
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/category")
public Result<List<ScreenKcCategoryNewsCountResultDTO>> getNewsCountGroupByCategory(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<List<ScreenKcCategoryNewsCountResultDTO>>().ok(kcScreenService.getNewsCountOfCategory(customerId));
}
/**
* 党建声音-分类的用户参与数排行
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/userparticategoryrank")
public Result<ScreenKcCategoryNewsRankResultDTO> getNewsPartiCategoryRank(ExternalAppRequestParam externalAppRequestParam){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<ScreenKcCategoryNewsRankResultDTO>().ok(kcScreenService.getNewsPartiCategoryRank(customerId));
}
/**
* 党建声音-热点新闻排行
* @param externalAppRequestParam
* @return
*/
@ExternalAppRequestAuth
@PostMapping("news/hotrank")
public Result<List<ScreenKcNewsHotRankResultDTO>> listNewsHotRank(ExternalAppRequestParam externalAppRequestParam,
@RequestBody PageFormDTO form){
String customerId = externalAppRequestParam.getCustomerId();
return new Result<List<ScreenKcNewsHotRankResultDTO>>().ok(kcScreenService.getNewsHotRank(customerId, form.getPageNo(), form.getPageSize()));
}
}

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

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.user.KcUserPointRankResultDTO;
import com.epmet.evaluationindex.screen.dto.result.PartyUserPointResultDTO;
import com.epmet.evaluationindex.screen.dto.result.UserPointResultDTO;
import org.apache.ibatis.annotations.Mapper;
@ -51,4 +52,5 @@ public interface ScreenPartyUserRankDataDao{
**/
List<PartyUserPointResultDTO> selectPartymemberPointOrder(@Param("agencyId")String agencyId);
List<KcUserPointRankResultDTO.KcUserPoint> listUserPoints(String customerId);
}

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsCategoryAnalysisDao.java

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcCategoryNewsCountResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-新闻-按类别统计(先根据customerId+dateId删除)
*
@ -28,4 +31,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsCategoryAnalysisDao {
List<ScreenKcCategoryNewsCountResultDTO> getNewsCountOfCategory(String customerId);
List<ScreenKcCategoryNewsCountResultDTO> listNewsPartiCategoryRank(String customerId);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsRankDao.java

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcNewsHotRankResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-热点新闻排行-(先根据customerId删除)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsRankDao {
List<ScreenKcNewsHotRankResultDTO> getNewsHotRank(String customerId);
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsSummaryDailyDao.java

@ -17,6 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcNewsSummaryResultDTO;
import org.apache.ibatis.annotations.Mapper;
/**
@ -28,4 +29,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsSummaryDailyDao {
ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcNewsTrendMonthlyDao.java

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.ScreenKcNewsPartiTrendResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-新闻参与趋势-(先根据customerId+monthId删除)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcNewsTrendMonthlyDao {
List<ScreenKcNewsPartiTrendResultDTO.ScreenKcNewsPartyCount> getNewsPartiTrend(String customerId);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcProjectSatisGridMonthlyDao.java

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.project.ProjectSatisfactionResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-项目满意度分析(customerId+monthId先删除记录再插入)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcProjectSatisGridMonthlyDao {
List<ProjectSatisfactionResultDTO> getProjectSatisfactionAnalyze(String customerId);
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserSummaryDailyDao.java

@ -17,8 +17,13 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.project.UserSummaryResultDTO;
import com.epmet.dto.result.user.KcUserPortrayalResultDTO;
import com.epmet.dto.result.user.KcUserRankResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-用户分析(先根据customerId+dateId删除后插入)
*
@ -28,4 +33,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcUserSummaryDailyDao {
UserSummaryResultDTO getUserSummary(String customerId);
List<KcUserRankResultDTO> getUserRank(String customerId);
KcUserPortrayalResultDTO.AgeDistribution getAgeDistribution(String customerId);
KcUserPortrayalResultDTO.GenderDistribution getGenderDistribution(String customerId);
}

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screenkc/ScreenKcUserTrendGridMonthlyDao.java

@ -17,8 +17,11 @@
package com.epmet.datareport.dao.evaluationindex.screenkc;
import com.epmet.dto.result.user.KcUserTrendResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* KC-用户趋势分析(根据monthId+customerId先删后增)
*
@ -28,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ScreenKcUserTrendGridMonthlyDao {
List<KcUserTrendResultDTO> getUserTrend(String customerId);
}

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

@ -3,6 +3,7 @@ package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.dto.result.issue.*;
import com.epmet.dto.result.project.*;
import com.epmet.dto.result.user.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -112,5 +113,25 @@ public interface KcScreenService {
List<ProjectAvgClosedTimeResultDTO> getGridProjectAvgClosedTimeAnalysis(String customerId);
ProjectSatisfaction getProjectSatisfactionAnalyze(String customerId);
ProjectSatisfactionResultDTO getProjectSatisfactionAnalyze(String customerId);
UserSummaryResultDTO getUserSummary(String customerId);
KcUserTrendResultDTO getUserTrend(String customerId);
KcUserRankResultDTO getUserRank(String customerId);
KcUserPortrayalResultDTO getUserPortrayal(String customerId);
KcUserPointRankResultDTO getUserPointsRank(String customerId, Integer pageNo, Integer pageSize);
ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId);
ScreenKcNewsPartiTrendResultDTO getNewsPartiTrend(String customerId);
List<ScreenKcCategoryNewsCountResultDTO> getNewsCountOfCategory(String customerId);
ScreenKcCategoryNewsRankResultDTO getNewsPartiCategoryRank(String customerId);
List<ScreenKcNewsHotRankResultDTO> getNewsHotRank(String customerId, Integer pageNo, Integer pageSize);
}

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

@ -4,11 +4,13 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
import com.epmet.datareport.dao.evaluationindex.screenkc.*;
import com.epmet.datareport.service.evaluationindex.screen.KcScreenService;
import com.epmet.datareport.utils.DateUtils;
import com.epmet.dto.result.issue.*;
import com.epmet.dto.result.project.*;
import com.epmet.dto.result.user.*;
import com.epmet.evaluationindex.screen.dto.form.GroupTopicShiftIssueRatioRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.GroupUserCountRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.HeartVolunteerrankFormDTO;
@ -16,6 +18,7 @@ import com.epmet.evaluationindex.screen.dto.result.*;
import com.epmet.evaluationindex.screen.dto.result.HomepageSummaryResultDTO;
import com.epmet.dto.result.issue.KcIssueSummary;
import com.epmet.dto.result.issue.KcPartiTrendResultDTO;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -71,6 +74,30 @@ public class KcScreenServiceImpl implements KcScreenService {
@Autowired
private ScreenKcProjectSummaryGridDailyDao projectSummaryGridDailyDao;
@Autowired
private ScreenKcProjectSatisGridMonthlyDao projectSatisGridMonthlyDao;
@Autowired
private ScreenKcUserSummaryDailyDao kcUserSummaryDailyDao;
@Autowired
private ScreenKcUserTrendGridMonthlyDao userTrendGridMonthlyDao;
@Autowired
private ScreenPartyUserRankDataDao partyUserRankDataDao;
@Autowired
private ScreenKcNewsSummaryDailyDao screenKcNewsSummaryDailyDao;
@Autowired
private ScreenKcNewsTrendMonthlyDao screenKcNewsTrendMonthlyDao;
@Autowired
private ScreenKcNewsCategoryAnalysisDao screenKcNewsCategoryAnalysisDao;
@Autowired
private ScreenKcNewsRankDao screenKcNewsRankDao;
/**
* @param externalAppRequestParam
* @Description 首页-平台各类总数
@ -162,7 +189,7 @@ public class KcScreenServiceImpl implements KcScreenService {
KcPartiTrendResultDTO result = new KcPartiTrendResultDTO();
trend.stream().forEach(t -> {
String month = t.getMonthId().substring(4);
result.getXAxis().add(new Integer(month).toString().concat("月"));
result.getxAxis().add(new Integer(month).toString().concat("月"));
result.getReportCountDataList().add(t.getReportCount());
});
return result;
@ -319,8 +346,119 @@ public class KcScreenServiceImpl implements KcScreenService {
}
@Override
public ProjectSatisfaction getProjectSatisfactionAnalyze(String customerId) {
public ProjectSatisfactionResultDTO getProjectSatisfactionAnalyze(String customerId) {
List<ProjectSatisfactionResultDTO> pss = projectSatisGridMonthlyDao.getProjectSatisfactionAnalyze(customerId);
ProjectSatisfactionResultDTO resultDTO = new ProjectSatisfactionResultDTO();
pss.stream().forEach(ps -> {
String monthNo = ps.getMonthId().substring(4);
resultDTO.getxAxis().add(new Integer(monthNo).toString().concat("月"));
resultDTO.getGreatSatisDataList().add(ps.getGreatSatis());
resultDTO.getGoodSatisDataList().add(ps.getGoodSatis());
resultDTO.getDisSatisDataList().add(ps.getDisSatis());
});
return resultDTO;
}
@Override
public UserSummaryResultDTO getUserSummary(String customerId) {
return kcUserSummaryDailyDao.getUserSummary(customerId);
}
@Override
public KcUserTrendResultDTO getUserTrend(String customerId) {
List<KcUserTrendResultDTO> userSomeNums = userTrendGridMonthlyDao.getUserTrend(customerId);
KcUserTrendResultDTO trend = new KcUserTrendResultDTO();
userSomeNums.stream().forEach(usm -> {
String monthStr = usm.getMonthId().substring(4);
trend.getxAxis().add(new Integer(monthStr).toString().concat("月"));
trend.getUserDataList().add(usm.getRegUserCount());
trend.getPartyUserDataList().add(usm.getPartyUserCount());
});
return trend;
}
@Override
public KcUserRankResultDTO getUserRank(String customerId) {
List<KcUserRankResultDTO> list = kcUserSummaryDailyDao.getUserRank(customerId);
KcUserRankResultDTO rank = new KcUserRankResultDTO();
list.stream().forEach(i -> {
rank.getGridNameDataList().add(i.getGridName());
rank.getTotalUserDataList().add(i.getViewUserCount());
});
return rank;
}
@Override
public KcUserPortrayalResultDTO getUserPortrayal(String customerId) {
KcUserPortrayalResultDTO.AgeDistribution ageDistribution = kcUserSummaryDailyDao.getAgeDistribution(customerId);
KcUserPortrayalResultDTO.GenderDistribution genderDistribution = kcUserSummaryDailyDao.getGenderDistribution(customerId);
KcUserPortrayalResultDTO portrayal = new KcUserPortrayalResultDTO();
portrayal.setAgeDistribution(ageDistribution);
portrayal.setGenderDistribution(genderDistribution);
return portrayal;
}
@Override
public KcUserPointRankResultDTO getUserPointsRank(String customerId, Integer pageNo, Integer pageSize) {
if (pageNo != null && pageSize != null) {
PageHelper.startPage(pageNo, pageSize);
}
List<KcUserPointRankResultDTO.KcUserPoint> userPoints = partyUserRankDataDao.listUserPoints(customerId);
KcUserPointRankResultDTO rank = new KcUserPointRankResultDTO();
userPoints.stream().forEach(p -> {
rank.getUserNameDataList().add(p.getUserName());
rank.getPointsDataList().add(p.getPointTotal());
});
return rank;
}
@Override
public ScreenKcNewsSummaryResultDTO getNewsSummary(String customerId) {
return screenKcNewsSummaryDailyDao.getNewsSummary(customerId);
}
@Override
public ScreenKcNewsPartiTrendResultDTO getNewsPartiTrend(String customerId) {
List<ScreenKcNewsPartiTrendResultDTO.ScreenKcNewsPartyCount> partyCounts =
screenKcNewsTrendMonthlyDao.getNewsPartiTrend(customerId);
ScreenKcNewsPartiTrendResultDTO trend = new ScreenKcNewsPartiTrendResultDTO();
partyCounts.stream().forEach(pc -> {
String monthId = pc.getMonthId();
trend.getxAxis().add(new Integer(monthId.substring(4)).toString().concat("月"));
trend.getPartiCountDataList().add(pc.getPartiCount());
});
return null;
return trend;
}
@Override
public List<ScreenKcCategoryNewsCountResultDTO> getNewsCountOfCategory(String customerId) {
return screenKcNewsCategoryAnalysisDao.getNewsCountOfCategory(customerId);
}
@Override
public ScreenKcCategoryNewsRankResultDTO getNewsPartiCategoryRank(String customerId) {
List<ScreenKcCategoryNewsCountResultDTO> partiCounts = screenKcNewsCategoryAnalysisDao.listNewsPartiCategoryRank(customerId);
ScreenKcCategoryNewsRankResultDTO rank = new ScreenKcCategoryNewsRankResultDTO();
partiCounts.stream().forEach(pc -> {
rank.getxAxis().add(pc.getCategoryName());
rank.getPartiCountDataList().add(pc.getPartiCount());
});
return rank;
}
@Override
public List<ScreenKcNewsHotRankResultDTO> getNewsHotRank(String customerId, Integer pageNo, Integer pageSize) {
if (pageNo != null && pageSize != null) {
PageHelper.startPage(pageNo, pageSize);
}
return screenKcNewsRankDao.getNewsHotRank(customerId);
}
}

9
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

@ -35,4 +35,13 @@
ORDER BY
POINT_TOTAL DESC
</select>
<select id="listUserPoints" resultType="com.epmet.dto.result.user.KcUserPointRankResultDTO$KcUserPoint">
select ur.USER_NAME userName,
ur.POINT_TOTAL pointTotal
from screen_party_user_rank_data ur
where ur.DEL_FLAG = 0
and ur.CUSTOMER_ID = #{customerId}
order by ur.POINT_TOTAL desc
</select>
</mapper>

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcIssueSummaryGridDailyDao.xml

@ -31,6 +31,7 @@
where t21.CUSTOMER_ID = #{customerId}) latest
on (isd.CUSTOMER_ID = latest.customerId and isd.DATE_ID = latest.max_date_id)
order by isd.ISSUE_COUNT desc
limit 7
</select>
<select id="getAvgAuditTimeRank" resultType="com.epmet.dto.result.issue.IssueAvgAuditTimeDTO">
@ -42,6 +43,7 @@
where t21.CUSTOMER_ID = #{customerId}) latest
on (isd.CUSTOMER_ID = latest.customerId and isd.DATE_ID = latest.max_date_id)
order by isd.AVG_AUDIT_TIME desc
limit 7
</select>
<select id="getIssueEffective" resultType="com.epmet.dto.result.issue.IssueEffectResultDTO">

30
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsCategoryAnalysisDao.xml

@ -3,4 +3,34 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsCategoryAnalysisDao">
<select id="getNewsCountOfCategory"
resultType="com.epmet.dto.result.user.ScreenKcCategoryNewsCountResultDTO">
select pcd.CATEGORY_ID categoryId,
pcd.CATEGORY_NAME categoryName,
pcd.NEWS_COUNT newsCount
from screen_kc_news_category_analysis pcd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_news_category_analysis
where CUSTOMER_ID = #{customerId}
and DEL_FLAG = 0
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
order by pcd.NEWS_COUNT asc
</select>
<select id="listNewsPartiCategoryRank"
resultType="com.epmet.dto.result.user.ScreenKcCategoryNewsCountResultDTO">
select pcd.CATEGORY_NAME categoryName,
(pcd.READ_COUNT + pcd.LIKE_COUNT + pcd.DIS_LIKE_COUNT) partiCount
from screen_kc_news_category_analysis pcd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_news_category_analysis
where CUSTOMER_ID = #{customerId}
and DEL_FLAG = 0
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
order by partiCount desc
</select>
</mapper>

16
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsRankDao.xml

@ -3,6 +3,18 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsRankDao">
<select id="getNewsHotRank" resultType="com.epmet.dto.result.user.ScreenKcNewsHotRankResultDTO">
select pcd.NEWS_ID newsId,
pcd.NEWS_TITLE newsTitle,
pcd.HOT_COUNT hotCount
from screen_kc_news_rank pcd
inner join (
select CUSTOMER_ID, max(DATE_ID) MAX_DATE_ID
from screen_kc_news_rank
where CUSTOMER_ID = #{customerId}
and DEL_FLAG = 0
) latest on (pcd.CUSTOMER_ID = latest.CUSTOMER_ID and pcd.DATE_ID = latest.MAX_DATE_ID)
where pcd.DEL_FLAG = 0
order by pcd.HOT_COUNT desc
</select>
</mapper>

18
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsSummaryDailyDao.xml

@ -3,6 +3,20 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsSummaryDailyDao">
<select id="getNewsSummary" resultType="com.epmet.dto.result.user.ScreenKcNewsSummaryResultDTO">
select ns.DATE_ID dateId,
ns.NEWS_COUNT newsCount,
ns.READ_COUNT readCount,
ns.COMMENT_COUNT commentCount,
ns.LIKE_COUNT likeCount
from screen_kc_news_summary_daily ns
inner join (
select CUSTOMER_ID,
max(DATE_ID) MAX_DATE_ID
from screen_kc_news_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (ns.CUSTOMER_ID = latest.CUSTOMER_ID and ns.DATE_ID = latest.MAX_DATE_ID)
where ns.DEL_FLAG = 0
</select>
</mapper>

11
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcNewsTrendMonthlyDao.xml

@ -3,6 +3,13 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcNewsTrendMonthlyDao">
<select id="getNewsPartiTrend"
resultType="com.epmet.dto.result.user.ScreenKcNewsPartiTrendResultDTO$ScreenKcNewsPartyCount">
select ntm.MONTH_ID, ntm.PARTI_COUNT
from screen_kc_news_trend_monthly ntm
where ntm.CUSTOMER_ID = #{customerId}
and ntm.DEL_FLAG = 0
order by MONTH_ID asc
limit 12
</select>
</mapper>

17
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSatisGridMonthlyDao.xml

@ -3,6 +3,19 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcProjectSatisGridMonthlyDao">
<select id="getProjectSatisfactionAnalyze" resultType="com.epmet.dto.result.project.ProjectSatisfactionResultDTO">
select t.monthId, greatSatis, goodSatis, disSatis
from (
select psm.MONTH_ID monthId,
sum(psm.GREAT_SATIS) greatSatis,
sum(psm.GOOD_SATIS) goodSatis,
sum(psm.DIS_SATIS) disSatis
from screen_kc_project_satis_grid_monthly psm
where psm.DEL_FLAG = 0
and psm.CUSTOMER_ID = #{customerId}
group by psm.MONTH_ID
) t
order by t.monthId asc
limit 12
</select>
</mapper>

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcProjectSummaryGridDailyDao.xml

@ -36,6 +36,7 @@
) latest on (psd.CUSTOMER_ID = latest.CUSTOMER_ID and psd.DATE_ID = latest.MAX_DATE_ID)
where DEL_FLAG = 0
order by psd.PROJECT_COUNT desc
limit 7
</select>
<!--网格的项目平均结案时间分析-->

56
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserSummaryDailyDao.xml

@ -3,6 +3,62 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcUserSummaryDailyDao">
<select id="getUserSummary" resultType="com.epmet.dto.result.project.UserSummaryResultDTO">
select usd.DATE_ID,
sum(usd.VISITOR_COUNT) vistorCount,
sum(usd.REG_USER_COUNT) regUserCount,
sum(usd.PARTY_USER_COUNT) partyUserCount
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
where DEL_FLAG = 0
</select>
<select id="getUserRank" resultType="com.epmet.dto.result.user.KcUserRankResultDTO">
select usd.GRID_ID gridId,
usd.GRID_NAME gridName,
usd.VISITOR_COUNT viewUserCount
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
order by viewUserCount desc
limit 7
</select>
<select id="getAgeDistribution"
resultType="com.epmet.dto.result.user.KcUserPortrayalResultDTO$AgeDistribution">
select sum(AGE_LEVEL_1) ageLevel1,
sum(AGE_LEVEL_2) ageLevel2,
sum(AGE_LEVEL_3) ageLevel3,
sum(AGE_LEVEL_4) ageLevel4,
sum(AGE_LEVEL_5) ageLevel5,
sum(AGE_LEVEL_6) ageLevel6
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
</select>
<select id="getGenderDistribution"
resultType="com.epmet.dto.result.user.KcUserPortrayalResultDTO$GenderDistribution">
select sum(MALE_PARTY_USER_COUNT) malePartyUserCount,
sum(FEMALE_PARTY_USER_COUNT) femalePartyUserCount
from screen_kc_user_summary_daily usd
inner join (
select max(DATE_ID) MAX_DATE_ID, CUSTOMER_ID
from screen_kc_user_summary_daily
where DEL_FLAG = 0
and CUSTOMER_ID = #{customerId}
) latest on (usd.DATE_ID = latest.MAX_DATE_ID and usd.CUSTOMER_ID = latest.CUSTOMER_ID)
</select>
</mapper>

13
epmet-module/data-report/data-report-server/src/main/resources/mapper/screenkc/ScreenKcUserTrendGridMonthlyDao.xml

@ -3,6 +3,15 @@
<mapper namespace="com.epmet.datareport.dao.evaluationindex.screenkc.ScreenKcUserTrendGridMonthlyDao">
<select id="getUserTrend" resultType="com.epmet.dto.result.user.KcUserTrendResultDTO">
select utm.MONTH_ID monthId,
sum(utm.REG_USER_COUNT) regUserCount,
sum(utm.PARTY_USER_COUNT) partyUserCount
from screen_kc_user_trend_grid_monthly utm
where utm.DEL_FLAG = 0
and utm.CUSTOMER_ID = #{customerId}
group by utm.MONTH_ID
order by utm.MONTH_ID asc
limit 12
</select>
</mapper>

51
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java

@ -115,6 +115,7 @@ public class IndexCalculateController {
/**
* 指标计算
*
* @param formDTO
*/
private void indexCalculate(CalculateCommonFormDTO formDTO) {
@ -137,29 +138,34 @@ public class IndexCalculateController {
/**
* 提交异步计算
*
* @param formDTO
* @return
*/
private void submitCalculate(CalculateCommonFormDTO formDTO) {
Future<?> future = singleThreadPool.submit(() -> {
long start = System.currentTimeMillis();
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
if (aBoolean) {
log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", formDTO.getCustomerId(), (System.currentTimeMillis() - start) / 1000);
}
try {
long start = System.currentTimeMillis();
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
if (aBoolean) {
log.error("客户Id:{},全部指标计算完成,总耗时:{}秒", formDTO.getCustomerId(), (System.currentTimeMillis() - start) / 1000);
}
redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
futureMap.remove(formDTO.getCustomerId());
redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
futureMap.remove(formDTO.getCustomerId());
//测试代码
//try {
// Thread.sleep(20000l);
// System.out.println(System.currentTimeMillis());
//} catch (InterruptedException e) {
// e.printStackTrace();
//}
//redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
//futureMap.remove(formDTO.getCustomerId());
//测试代码
//try {
// Thread.sleep(20000l);
// System.out.println(System.currentTimeMillis());
//} catch (InterruptedException e) {
// e.printStackTrace();
//}
//redisUtils.delete(RedisKeys.getCustomerStatsCalFlag(formDTO.getCustomerId()));
//futureMap.remove(formDTO.getCustomerId());
} catch (Exception e) {
log.warn("submitCalculate exception", e);
}
});
futureMap.put(formDTO.getCustomerId(), future);
@ -172,6 +178,7 @@ public class IndexCalculateController {
/**
* 终止计算
*
* @param form
* @return
*/
@ -194,10 +201,14 @@ public class IndexCalculateController {
@PostMapping("reAll")
public Result<Boolean> calculateAll(@RequestBody CalculateCommonFormDTO formDTO) {
long start = System.currentTimeMillis();
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() + "客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
if (aBoolean) {
return new Result<Boolean>().ok(true);
try {
Boolean aBoolean = indexCalculateService.indexCalculate(formDTO);
HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() + "客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
if (aBoolean) {
return new Result<Boolean>().ok(true);
}
} catch (Exception e) {
return new Result<Boolean>().error(e.getMessage());
}
return new Result<Boolean>().error("指标计算失败");
}

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -34,8 +34,8 @@ import java.util.List;
@Mapper
public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEntity> {
/**
*14组织层级
* 1) 根据CUSTOMER_ID 进行查询如果有数据则先进行物理删除, 一次删除1000条
* 14组织层级
* 1) 根据CUSTOMER_ID 进行查询如果有数据则先进行物理删除, 一次删除1000条
*
* @param customerId
* @return java.util.Integer
@ -46,24 +46,25 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
/**
* 14组织层级
* 2) 在批量新增
* 2) 在批量新增
*
* @param list
* @param customerId
* @Author zhangyong
* @Date 10:52 2020-08-18
**/
void batchInsertCustomerAgency(@Param("list") List<CustomerAgencyFormDTO> list, @Param("customerId")String customerId);
void batchInsertCustomerAgency(@Param("list") List<CustomerAgencyFormDTO> list, @Param("customerId") String customerId);
/**
* 返回当前客户下未匹配到的 社区级 组织信息
* @param customerId 客户id
* @param agencyIds 组织id集合
*
* @param customerId 客户id
* @param agencyIds 组织id集合
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity>
* @Author zhangyong
* @Date 14:38 2020-09-04
**/
List<ScreenCustomerAgencyEntity> selectListMismatcCommunityAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds);
List<ScreenCustomerAgencyEntity> selectListMismatcCommunityAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds);
/**
* 根据客户id查询区/街道 组织名称id
@ -73,24 +74,32 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerAgencyEntity> selectListAgencyInfo(@Param("customerId")String customerId);
List<ScreenCustomerAgencyEntity> selectListAgencyInfo(@Param("customerId") String customerId);
/**
* @Description 根据agencyId查询上级组织Id
* @param agencyId
* @Description 根据agencyId查询上级组织Id
* @author zxc
* @date 2020/9/8 3:36 下午
*/
String selectPid(@Param("agencyId")String agencyId);
String selectPid(@Param("agencyId") String agencyId);
/**
* 返回当前客户下未匹配到的 街道区县级 组织信息
* @param customerId 客户id
* @param agencyIds 组织id集合
*
* @param customerId 客户id
* @param agencyIds 组织id集合
* @return java.util.List<com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity>
* @Author zhangyong
* @Date 14:38 2020-09-04
**/
List<ScreenCustomerAgencyEntity> selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId")String customerId, @Param("agencyIds") String[] agencyIds);
List<ScreenCustomerAgencyEntity> selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds);
/**
* desc:获取客户的组织条数
*
* @param customerId
* @return
*/
int selectCountByCustomerId(@Param("customerId") String customerId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java

@ -75,8 +75,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
//获取指标权重
List<IndexGroupDetailEntity> parentIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
if (CollectionUtils.isEmpty(parentIndexDetails)) {
log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【党员相关】指标权重信息不存在");
log.error("cpcIndexCalculate customerId:{} have not init index", formDTO.getCustomerId());
throw new RenException("客户Id:" + formDTO.getCustomerId() + "【党员相关】指标权重信息不存在");
}
Map<String, IndexGroupDetailEntity> indexWeightMap = parentIndexDetails.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, o -> o));
int pageNo = NumConstant.ONE;

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java

@ -6,6 +6,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.redis.IndexCalRedis;
@ -47,6 +48,8 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
private DeptScoreService deptScoreService;
@Autowired
private FactIndexCollectService factIndexCollectService;
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Override
@ -91,6 +94,12 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
Boolean flag;
long start = System.currentTimeMillis();
try {
//校验是否含有组织数据
int agencyCount = screenCustomerAgencyDao.selectCountByCustomerId(formDTO.getCustomerId());
if (agencyCount < 1) {
log.info("客户id:{},组织结构数据缺失,请先上传后再计算", formDTO.getCustomerId());
throw new RenException("组织结构数据缺失,请先上传后再计算");
}
//计算党员相关的
try {

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java

@ -64,6 +64,10 @@ public class BatchScoreCalculator {
} else {
normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold));
}
//反正切函数 [-pi/2,pi/2]
if (idx.getScoreCalculator().getMaxValue().compareTo(idx.getScoreCalculator().getMinValue()) == 0) {
normalizeValue = new BigDecimal(Math.atan(new Double(vo.getSampleValue().toString())) / Math.PI * 100).setScale(6, RoundingMode.HALF_UP);
}
BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP);
CalculateResult result = scoreCountOfSamples.get(sampleId);

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -128,4 +128,9 @@
</foreach>
</if>
</select>
<select id="selectCountByCustomerId" resultType="int">
select count(*) from screen_customer_agency
where DEL_FLAG = '0' and CUSTOMER_ID = #{customerId}
</select>
</mapper>

28
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java

@ -257,5 +257,33 @@ public class DemoScoreCal {
System.err.println("-----------------2222222222---------------");
}
@Test
public void testMath() {
// 每个指标需要单独的分支计算器,因为每个指标的最大最小值是不同的
ScoreCalculator<Integer> sc1 = new BigDecimalScoreCalculator(new BigDecimal(8), new BigDecimal(8), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
ScoreCalculator<Integer> sc2 = new BigDecimalScoreCalculator(new BigDecimal(10), new BigDecimal(10), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue<Integer>> index1SampleValues = Arrays.asList(new SampleValue<>("id1", 4), new SampleValue<>("id2", 1), new SampleValue<>("id3", 8));
List<SampleValue<Integer>> index2SampleValues = Arrays.asList(new SampleValue<>("id1", 1), new SampleValue<>("id2", 8), new SampleValue<>("id3", 3));
// 每个指标的信息,包括样本列表,权重,指标标记
IndexInputVO<Integer> index1VO = new IndexInputVO<>("aaa", "a:bbb2", index1SampleValues, new BigDecimal(10), new BigDecimal(1), false, sc1);
IndexInputVO<Integer> index2VO = new IndexInputVO<>("bbb", "a:bbb2", index2SampleValues, new BigDecimal(10), new BigDecimal(1), false, sc2);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, CalculateResult> result = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
System.err.println("--------------------------------");
result.forEach((key, value) -> {
System.out.println(key.concat("的总得分为:") + value.getTotalScore());
//System.out.println(JSON.toJSONString(indexInputVOS));
value.getDetails().forEach(o -> System.out.println(JSON.toJSONString(o)));
});
System.err.println("--------------------------------");
}
}

17
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java

@ -0,0 +1,17 @@
package com.epmet.stats.test.normalizing;
public class MathUtilTest {
public static void main(String[] args) {
double tan = Math.atan(4);
double tan2 = Math.atan(1);
double tan3 = Math.atan(8);
double tan4 = Math.atan(3);
System.out.println((tan / Math.PI));
System.out.println((tan2 / Math.PI));
System.out.println((tan3 / Math.PI));
System.out.println((tan4 / Math.PI * 200));
}
}

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

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

126
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/PersonalTemplateDTO.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-09-09
*/
@Data
public class PersonalTemplateDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 小程序类型 居民端resi,工作端work
*/
private String clientType;
/**
* APPID
*/
private String appId;
/**
* 主模板ID
*/
private String pid;
/**
* 添加至帐号下的模板id
*/
private String priTmplId;
/**
* 模板类型2 代表一次性订阅3 代表长期订阅
*/
private String type;
/**
* 模板ID
*/
private String tid;
/**
* 模板标题
*/
private String title;
/**
* 关键词ID
*/
private String keyIds;
/**
* 关键词
*/
private String keyWords;
/**
* 服务场景描述15个字以内
*/
private String sceneDesc;
/**
* 乐观锁
*/
private Integer revision;
/**
* 是否删除
*/
private String delFlag;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

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

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-11
*/
@Data
public class PublicTemplateDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
*
*/
private String tid;
/**
*
*/
private String title;
/**
*
*/
private String type;
/**
*
*/
private String categoryId;
/**
*
*/
private Integer revision;
/**
*
*/
private String delFlag;
/**
*
*/
private String createdBy;
/**
*
*/
private Date createdTime;
/**
*
*/
private String updatedBy;
/**
*
*/
private Date updatedTime;
}

51
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java

@ -0,0 +1,51 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:20
*/
@NoArgsConstructor
@Data
public class AddTemplateFormDTO implements Serializable {
private static final long serialVersionUID = 8721859887464107897L;
/**
* appId
*/
private String appId;
/**
* 公共模板标题 id
*/
private String tid;
/**
* 公共模板标题
*/
private String title;
/**
* 服务场景描述15个字以内
*/
private String sceneDesc;
/**
* 工作端(gov)居民端(resi)
*/
private String clientType;
/**
* 模板类型2 代表一次性订阅3 代表长期订阅
*/
private String type;
/**
* 关键词id最多支持5个最少2个关键词组合
*/
private List<Integer> kidList;
/**
* 关键字名称
*/
private List<String> nameList;
}

17
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelTemplateFormDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:23
*/
@Data
public class DelTemplateFormDTO implements Serializable {
private static final long serialVersionUID = -3468604475671634840L;
private String appId;
private String priTmplId;
}

39
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/10 16:22
*/
@NoArgsConstructor
@Data
public class InitFormDTO implements Serializable {
private static final long serialVersionUID = -7120483520014483199L;
/**
* 客户ID
*/
private String customerId;
/**
* 居民端测试号AppID
*/
private String resiAppId;
/**
* 工作端测试号AppID
*/
private String workAppId;
/**
* 居民端需要同步的模板id数组
*/
private List<String> resiTempIdList;
/**
* 工作端需要同步的模板id数组
*/
private List<String> workTempIdList;
}

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

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:58
*/
@NoArgsConstructor
@Data
public class PubTemplateFormDTO implements Serializable {
private static final long serialVersionUID = 9023183147998651076L;
private String appId;
/**
* 类目 id多个用逗号隔开
*/
private String ids;
private String title;
private Integer pageNo;
private Integer pageSize;
}

19
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubscribeFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:19
*/
@NoArgsConstructor
@Data
public class SubscribeFormDTO implements Serializable {
private static final long serialVersionUID = -4637357527979131441L;
private String appId;
private String titleId;
}

18
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerTempResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/11 14:02
*/
@NoArgsConstructor
@Data
public class CustomerTempResultDTO {
private List<TemplateDTO> workList;
private List<TemplateDTO> resiList;
}

47
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/GetTemplateResultDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:36
*/
@NoArgsConstructor
@Data
public class GetTemplateResultDTO implements Serializable {
private static final long serialVersionUID = -3558254681242362668L;
/**
* 添加至帐号下的模板 id发送小程序订阅消息时所需
*/
private String priTmplId;
/**
* 模板标题
*/
private String title;
/**
* 模板内容
*/
private String content;
/**
* 模板内容示例
*/
private String example;
/**
* 模板类型2 代表一次性订阅3 代表长期订阅
*/
private String type;
/**
* 关键词名称逗号隔开
*/
private String kidNames;
/**
* 场景说明
*/
private String sceneDesc;
}

34
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/KeyWordsResultDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:34
*/
@NoArgsConstructor
@Data
public class KeyWordsResultDTO implements Serializable {
private static final long serialVersionUID = 3082505411447366845L;
/**
* 关键词 id
*/
private Integer kid;
/**
* 关键词内容
*/
private String name;
/**
* 关键词内容对应的示例
*/
private String example;
/**
* 参数类型
*/
private String rule;
}

39
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/PubTemplateResultDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:27
*/
@NoArgsConstructor
@Data
public class PubTemplateResultDTO implements Serializable {
private static final long serialVersionUID = -1563615907119995448L;
/**
* 模板标题 id
*/
private Integer tid;
/**
* 模板标题
*/
private String title;
/**
* 模板类型2 为一次性订阅3 为长期订阅
*/
private Integer type;
/**
* 模板所属类目 id
*/
private String categoryId;
/**
* 关键词
*/
private List<String> keywords;
}

17
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/SubscribeCategoryResultDTO.java

@ -0,0 +1,17 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 14:25
*/
@Data
public class SubscribeCategoryResultDTO implements Serializable {
private static final long serialVersionUID = -2539495405169212998L;
private Integer id;
private String name;
}

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

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/11 14:38
*/
@Data
public class TemplateDTO implements Serializable {
private static final long serialVersionUID = 1709155656984339643L;
/**
* 模板ID
*/
private String id;
/**
* 模板ID
*/
private String tmplId;
/**
* 标题
*/
private String title;
/**
* 同步状态 0未同步 1同步
*/
private String state;
}

149
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java

@ -0,0 +1,149 @@
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerTempResultDTO;
import com.epmet.dto.result.GetTemplateResultDTO;
import com.epmet.dto.result.KeyWordsResultDTO;
import com.epmet.dto.result.SubscribeCategoryResultDTO;
import com.epmet.service.SubscribeService;
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 zhaoqifeng
* @dscription
* @date 2020/9/10 13:44
*/
@RestController
@RequestMapping("subscribe")
public class SubscribeController {
@Autowired
private SubscribeService subscribeService;
/**
* 获取当前帐号所设置的类目信息
*
* @param formDTO
* @return com.epmet.dto.result.SubscribeCategoryResultDTO
* @author zhaoqifeng
* @date 2020/9/9 14:57
*/
@PostMapping("getcategory")
public Result<List<SubscribeCategoryResultDTO>> getCategory(@RequestBody SubscribeFormDTO formDTO) {
List<SubscribeCategoryResultDTO> result = subscribeService.getCategory(formDTO);
return new Result<List<SubscribeCategoryResultDTO>>().ok(result);
}
/**
* 获取模板标题列表
*
* @param formDTO
* @return com.epmet.dto.result.PubTemplateResultDTO
* @author zhaoqifeng
* @date 2020/9/9 15:00
*/
@PostMapping("getpubtemplatetitles")
public Result<PageData> getPubTemplateTitles(@RequestBody PubTemplateFormDTO formDTO) {
PageData result = subscribeService.getPubTemplateTitles(formDTO);
return new Result<PageData>().ok(result);
}
/**
* 同步微信公共模板
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2020/9/11 16:11
*/
@PostMapping("syncpubtemplatetitles")
public Result syncPubTemplateTitles(@RequestBody PubTemplateFormDTO formDTO) {
subscribeService.syncPubTemplateTitles(formDTO);
return new Result();
}
/**
* 获取模板标题下的关键词库
*
* @param formDTO
* @return com.epmet.dto.result.KeyWordsResultDTO
* @author zhaoqifeng
* @date 2020/9/9 15:10
*/
@PostMapping("getkeywords")
public Result<List<KeyWordsResultDTO>> getKeyWords(@RequestBody SubscribeFormDTO formDTO) {
List<KeyWordsResultDTO> result = subscribeService.getKeyWords(formDTO);
return new Result<List<KeyWordsResultDTO>>().ok(result);
}
/**
* 获取帐号下的模板列表
*
* @param formDTO
* @return com.epmet.dto.result.GetTemplateResultDTO
* @author zhaoqifeng
* @date 2020/9/9 15:12
*/
@PostMapping("gettemplate")
public Result<List<GetTemplateResultDTO>> getTemplate(@RequestBody SubscribeFormDTO formDTO) {
List<GetTemplateResultDTO> result = subscribeService.getTemplate(formDTO);
return new Result<List<GetTemplateResultDTO>>().ok(result);
}
/**
* 添加个人模板
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/9/9 15:13
*/
@PostMapping("addtemplate")
public Result addTemplate(@RequestBody AddTemplateFormDTO formDTO) {
subscribeService.addTemplate(formDTO);
return new Result();
}
/**
* 删除账号下模板
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/9/9 15:13
*/
@PostMapping("deltemplate")
public Result delTemplate(@RequestBody DelTemplateFormDTO formDTO) {
subscribeService.delTemplate(formDTO);
return new Result();
}
/**
* 客户初始化
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2020/9/11 9:25
*/
@PostMapping("init")
public Result init(@RequestBody InitFormDTO formDTO) {
subscribeService.init(formDTO);
return new Result();
}
@PostMapping("getcustomerlist")
public Result<CustomerTempResultDTO> getCustomerTemplate(@RequestBody InitFormDTO formDTO) {
CustomerTempResultDTO result = subscribeService.getCustomerTemplate(formDTO);
return new Result<CustomerTempResultDTO>().ok(result);
}
}

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

@ -118,4 +118,13 @@ public interface AuthorizationInfoDao extends BaseDao<AuthorizationInfoEntity> {
* @date 2020.08.25 15:24
**/
List<AuthAccessTokenClientResultDTO> selectClientToken(@Param("customerId") String customerId);
/**
* 根据APPID获取auth信息
* @author zhaoqifeng
* @date 2020/9/9 15:23
* @param appId
* @return com.epmet.dto.AuthorizationInfoDTO
*/
AuthorizationInfoDTO selectInfoByAppId(@Param("appId") String appId);
}

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

@ -120,4 +120,13 @@ public interface PaCustomerDao extends BaseDao<PaCustomerEntity> {
* @date 2020.08.26 10:59
**/
String selectSourceById(@Param("customerId") String customerId,@Param("source") String source);
/**
* 根据测试号查询同源的客户列表
* @author zhaoqifeng
* @date 2020/9/9 17:23
* @param customerId
* @return java.util.List<com.epmet.dto.PaCustomerDTO>
*/
List<PaCustomerDTO> selectCustomerListByTestId(@Param("customerId") String customerId);
}

79
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.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.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.PersonalTemplateDTO;
import com.epmet.dto.result.CustomerTempResultDTO;
import com.epmet.dto.result.TemplateDTO;
import com.epmet.entity.PersonalTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-09
*/
@Mapper
public interface PersonalTemplateDao extends BaseDao<PersonalTemplateEntity> {
/**
* 获取个人模板列表
*
* @param pid
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
* @author zhaoqifeng
* @date 2020/9/9 17:56
*/
List<PersonalTemplateDTO> selectListByPid(@Param("pid") String pid);
/**
* 根据AppID获取模板列表
*
* @param appId
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
* @author zhaoqifeng
* @date 2020/9/10 10:49
*/
List<PersonalTemplateDTO> selectListByAppId(@Param("appId") String appId);
/**
* 获取已配置的模板
*
* @param customerId
* @param pid
* @return com.epmet.dto.PersonalTemplateDTO
* @author zhaoqifeng
* @date 2020/9/11 9:42
*/
PersonalTemplateDTO selectSetTemp(@Param("customerId") String customerId, @Param("pid") String pid);
/**
* 根据客户Id获取模板列表
*
* @param appId
* @param customerId
* @param clientType
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
* @author zhaoqifeng
* @date 2020/9/11 14:35
*/
List<TemplateDTO> selectListByCustomerId(@Param("appId") String appId, @Param("customerId") String customerId,
@Param("clientType") String clientType);
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PublicTemplateDao.java

@ -0,0 +1,56 @@
/**
* 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.form.PubTemplateFormDTO;
import com.epmet.dto.result.PubTemplateResultDTO;
import com.epmet.entity.PublicTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-11
*/
@Mapper
public interface PublicTemplateDao extends BaseDao<PublicTemplateEntity> {
/**
* 根据类目Id删除模板
* @author zhaoqifeng
* @date 2020/9/11 16:22
* @param list
* @return void
*/
void deleteTempByCategoryId(List<String> list);
/**
* 获取公共模板列表
* @author zhaoqifeng
* @date 2020/9/11 16:57
* @param dto
* @return java.util.List<com.epmet.dto.result.PubTemplateResultDTO>
*/
List<PubTemplateResultDTO> getPubTempList(PubTemplateFormDTO dto);
}

96
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/PersonalTemplateEntity.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-09-09
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("personal_template")
public class PersonalTemplateEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 小程序类型 居民端resi,工作端work
*/
private String clientType;
/**
* APPID
*/
private String appId;
/**
* 主模板ID
*/
private String pid;
/**
* 添加至帐号下的模板id
*/
private String priTmplId;
/**
* 模板类型2 代表一次性订阅3 代表长期订阅
*/
private String type;
/**
* 模板ID
*/
private String tid;
/**
* 模板标题
*/
private String title;
/**
* 关键词ID
*/
private String keyIds;
/**
* 关键词
*/
private String keyWords;
/**
* 服务场景描述15个字以内
*/
private String sceneDesc;
}

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

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

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

@ -233,4 +233,13 @@ public interface PaCustomerService extends BaseService<PaCustomerEntity> {
* @date 2020.08.25 15:46
**/
void clearPublicCustomer(CommonCustomerIdAndSrcFormDTO param);
/**
* 根据测试号查询同源的客户列表
* @author zhaoqifeng
* @date 2020/9/9 17:32
* @param customerId
* @return java.util.List<com.epmet.dto.PaCustomerDTO>
*/
List<PaCustomerDTO> getCustomerListByTestId(String customerId);
}

126
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.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.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.PersonalTemplateDTO;
import com.epmet.dto.result.TemplateDTO;
import com.epmet.entity.PersonalTemplateEntity;
import java.util.List;
import java.util.Map;
/**
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-09
*/
public interface PersonalTemplateService extends BaseService<PersonalTemplateEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PersonalTemplateDTO>
* @author generator
* @date 2020-09-09
*/
PageData<PersonalTemplateDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<PersonalTemplateDTO>
* @author generator
* @date 2020-09-09
*/
List<PersonalTemplateDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return PersonalTemplateDTO
* @author generator
* @date 2020-09-09
*/
PersonalTemplateDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-09-09
*/
void save(PersonalTemplateDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-09-09
*/
void update(PersonalTemplateDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-09-09
*/
void delete(String[] ids);
/**
* 获取个人模板列表
*
* @param pid
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
* @author zhaoqifeng
* @date 2020/9/9 17:59
*/
List<PersonalTemplateDTO> getListByPid(String pid);
/**
* 根据AppID获取模板列表
*
* @param appId
* @return java.util.List<com.epmet.dto.PersonalTemplateDTO>
* @author zhaoqifeng
* @date 2020/9/10 10:48
*/
List<PersonalTemplateDTO> getListByAppId(String appId);
/**
* 根据客户Id获取模板列表
*
* @param appId
* @param customerId
* @param clientType
* @return java.util.List<com.epmet.dto.result.TemplateDTO>
* @author zhaoqifeng
* @date 2020/9/11 14:43
*/
List<TemplateDTO> getListByCustomer(String appId, String customerId, String clientType);
}

115
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PublicTemplateService.java

@ -0,0 +1,115 @@
/**
* 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.PublicTemplateDTO;
import com.epmet.dto.form.PubTemplateFormDTO;
import com.epmet.dto.result.PubTemplateResultDTO;
import com.epmet.entity.PublicTemplateEntity;
import java.util.List;
import java.util.Map;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-11
*/
public interface PublicTemplateService extends BaseService<PublicTemplateEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<PublicTemplateDTO>
* @author generator
* @date 2020-09-11
*/
PageData<PublicTemplateDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<PublicTemplateDTO>
* @author generator
* @date 2020-09-11
*/
List<PublicTemplateDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return PublicTemplateDTO
* @author generator
* @date 2020-09-11
*/
PublicTemplateDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-09-11
*/
void save(PublicTemplateDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-09-11
*/
void update(PublicTemplateDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-09-11
*/
void delete(String[] ids);
/**
* 根据类目Id删除模板
* @author zhaoqifeng
* @date 2020/9/11 16:29
* @param categoryIds
* @return void
*/
void deleteTempByCategoryId(List<String> categoryIds);
/**
* 获取公共模板列表
* @author zhaoqifeng
* @date 2020/9/11 17:01
* @param dto
* @return java.util.List<com.epmet.dto.result.PubTemplateResultDTO>
*/
List<PubTemplateResultDTO> getPubTempList(PubTemplateFormDTO dto);
}

105
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java

@ -0,0 +1,105 @@
package com.epmet.service;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 11:02
*/
public interface SubscribeService {
/**
* 获取当前帐号所设置的类目信息
*
* @param formDTO
* @return com.epmet.dto.result.SubscribeCategoryResultDTO
* @author zhaoqifeng
* @date 2020/9/9 14:57
*/
List<SubscribeCategoryResultDTO> getCategory(SubscribeFormDTO formDTO);
/**
* 获取模板标题列表
*
* @param formDTO
* @return com.epmet.dto.result.PubTemplateResultDTO
* @author zhaoqifeng
* @date 2020/9/9 15:00
*/
PageData getPubTemplateTitles(PubTemplateFormDTO formDTO);
/**
* 同步微信公共模板
* @author zhaoqifeng
* @date 2020/9/11 15:26
* @param formDTO
* @return void
*/
void syncPubTemplateTitles(PubTemplateFormDTO formDTO);
/**
* 获取模板标题下的关键词库
*
* @param formDTO
* @return com.epmet.dto.result.KeyWordsResultDTO
* @author zhaoqifeng
* @date 2020/9/9 15:10
*/
List<KeyWordsResultDTO> getKeyWords(SubscribeFormDTO formDTO);
/**
* 获取帐号下的模板列表
*
* @param formDTO
* @return com.epmet.dto.result.GetTemplateResultDTO
* @author zhaoqifeng
* @date 2020/9/9 15:12
*/
List<GetTemplateResultDTO> getTemplate(SubscribeFormDTO formDTO);
/**
* 添加个人模板
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/9/9 15:13
*/
void addTemplate(AddTemplateFormDTO formDTO);
/**
* 删除账号下模板
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/9/9 15:13
*/
void delTemplate(DelTemplateFormDTO formDTO);
/**
* 客户初始化
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/9/10 16:25
*/
void init(InitFormDTO formDTO);
/**
* 获取客户模板列表
*
* @param formDTO
* @return com.epmet.dto.result.CustomerTempResultDTO
* @author zhaoqifeng
* @date 2020/9/11 14:04
*/
CustomerTempResultDTO getCustomerTemplate(InitFormDTO formDTO);
}

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

@ -15,6 +15,7 @@ import com.epmet.dao.MiniInfoDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.*;
import com.epmet.wxapi.param.*;
@ -68,6 +69,8 @@ public class CodeServiceImpl implements CodeService {
private PaCustomerService paCustomerService;
@Autowired
private MiniInfoDao miniInfoDao;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Override
public List<TemplateListResultDTO> templateList() {
@ -97,11 +100,7 @@ public class CodeServiceImpl implements CodeService {
@Override
public String getExtJson(CodeUploadFormDTO formDTO) {
CodeExtDTO codeExtDTO = codeExtService.getExtByCustomer(formDTO.getCustomerId(), formDTO.getClientType());
if (null == codeExtDTO) {
return codeExtService.getExtTemplate(formDTO.getClientType());
}
return codeExtDTO.getExtJson();
return codeExtService.getExtTemplate(formDTO.getClientType());
}
@ -118,15 +117,27 @@ public class CodeServiceImpl implements CodeService {
if (null == authInfo) {
throw new RenException("未授权");
}
CustomerDTO customerFormDTO = new CustomerDTO();
customerFormDTO.setId(formDTO.getCustomerId());
Result<CustomerDTO> result = operCrmOpenFeignClient.getCustomerInfo(customerFormDTO);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
}
//获取小程序居民端与工作端名称
String resiName = miniInfoDao.getNickName(formDTO.getCustomerId(), "resi");
String workName = miniInfoDao.getNickName(formDTO.getCustomerId(), "work");
String resiName = miniInfoDao.getNickName(formDTO.getCustomerId(), CodeConstant.RESI);
String workName = miniInfoDao.getNickName(formDTO.getCustomerId(), CodeConstant.WORK);
String extJson = getExtJson(formDTO);
WxExtJson wxExtJson = JSONObject.parseObject(extJson, WxExtJson.class);
wxExtJson.setExtAppid(authInfo.getAuthorizerAppid());
wxExtJson.getExt().setExtAppid(authInfo.getAuthorizerAppid());
wxExtJson.getExt().setResiName(resiName);
wxExtJson.getExt().setWorkName(workName);
wxExtJson.getExt().setCustomerName(null == result.getData().getCustomerName()?"":result.getData().getCustomerName());
if (CodeConstant.RESI.equals(formDTO.getClientType())) {
wxExtJson.getWindow().setNavigationBarTitleText(resiName);
} else {
wxExtJson.getWindow().setNavigationBarTitleText(workName);
}
extJson = JSON.toJSONString(wxExtJson);
CodeExtDTO codeExtDTO = codeExtService.getExtByCustomer(formDTO.getCustomerId(), formDTO.getClientType());
if (null == codeExtDTO) {

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

@ -697,4 +697,9 @@ public class PaCustomerServiceImpl extends BaseServiceImpl<PaCustomerDao, PaCust
baseDao.clearCustomerInfo(param.getCustomerId());
}
@Override
public List<PaCustomerDTO> getCustomerListByTestId(String customerId) {
return baseDao.selectCustomerListByTestId(customerId);
}
}

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

@ -0,0 +1,119 @@
/**
* 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.constant.FieldConstant;
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.result.TemplateDTO;
import com.epmet.entity.PersonalTemplateEntity;
import com.epmet.service.PersonalTemplateService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
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-09-09
*/
@Service
public class PersonalTemplateServiceImpl extends BaseServiceImpl<PersonalTemplateDao, PersonalTemplateEntity> implements PersonalTemplateService {
@Override
public PageData<PersonalTemplateDTO> page(Map<String, Object> params) {
IPage<PersonalTemplateEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PersonalTemplateDTO.class);
}
@Override
public List<PersonalTemplateDTO> list(Map<String, Object> params) {
List<PersonalTemplateEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PersonalTemplateDTO.class);
}
private QueryWrapper<PersonalTemplateEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PersonalTemplateEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public PersonalTemplateDTO get(String id) {
PersonalTemplateEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, PersonalTemplateDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PersonalTemplateDTO dto) {
PersonalTemplateEntity entity = ConvertUtils.sourceToTarget(dto, PersonalTemplateEntity.class);
insert(entity);
//copy主键值到dto
BeanUtils.copyProperties(entity, dto);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PersonalTemplateDTO dto) {
PersonalTemplateEntity entity = ConvertUtils.sourceToTarget(dto, PersonalTemplateEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public List<PersonalTemplateDTO> getListByPid(String pid) {
return baseDao.selectListByPid(pid);
}
@Override
public List<PersonalTemplateDTO> getListByAppId(String appId) {
return baseDao.selectListByAppId(appId);
}
@Override
public List<TemplateDTO> getListByCustomer(String appId, String customerId, String clientType) {
return baseDao.selectListByCustomerId(appId, customerId, clientType);
}
}

112
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PublicTemplateServiceImpl.java

@ -0,0 +1,112 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.PublicTemplateDao;
import com.epmet.dto.PublicTemplateDTO;
import com.epmet.dto.form.PubTemplateFormDTO;
import com.epmet.dto.result.PubTemplateResultDTO;
import com.epmet.entity.PublicTemplateEntity;
import com.epmet.service.PublicTemplateService;
import org.apache.commons.lang3.StringUtils;
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-09-11
*/
@Service
public class PublicTemplateServiceImpl extends BaseServiceImpl<PublicTemplateDao, PublicTemplateEntity> implements PublicTemplateService {
@Override
public PageData<PublicTemplateDTO> page(Map<String, Object> params) {
IPage<PublicTemplateEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, PublicTemplateDTO.class);
}
@Override
public List<PublicTemplateDTO> list(Map<String, Object> params) {
List<PublicTemplateEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, PublicTemplateDTO.class);
}
private QueryWrapper<PublicTemplateEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<PublicTemplateEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public PublicTemplateDTO get(String id) {
PublicTemplateEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, PublicTemplateDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(PublicTemplateDTO dto) {
PublicTemplateEntity entity = ConvertUtils.sourceToTarget(dto, PublicTemplateEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PublicTemplateDTO dto) {
PublicTemplateEntity entity = ConvertUtils.sourceToTarget(dto, PublicTemplateEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public void deleteTempByCategoryId(List<String> categoryIds) {
baseDao.deleteTempByCategoryId(categoryIds);
}
@Override
public List<PubTemplateResultDTO> getPubTempList(PubTemplateFormDTO formDTO) {
return baseDao.getPubTempList(formDTO);
}
}

445
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java

@ -0,0 +1,445 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.AuthorizationInfoDao;
import com.epmet.dto.AuthorizationInfoDTO;
import com.epmet.dto.PaCustomerDTO;
import com.epmet.dto.PersonalTemplateDTO;
import com.epmet.dto.PublicTemplateDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.PublicTemplateEntity;
import com.epmet.service.PaCustomerService;
import com.epmet.service.PersonalTemplateService;
import com.epmet.service.PublicTemplateService;
import com.epmet.service.SubscribeService;
import com.epmet.wxapi.param.WxAddTemplateReq;
import com.epmet.wxapi.param.WxDelTemplateReq;
import com.epmet.wxapi.param.WxSubTemplateReq;
import com.epmet.wxapi.result.*;
import com.epmet.wxapi.service.WxMaSubscribeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 11:02
*/
@Slf4j
@Service
public class SubscribeServiceImpl implements SubscribeService {
@Autowired
private AuthorizationInfoDao authorizationInfoDao;
@Autowired
private WxMaSubscribeService wxMaSubscribeService;
@Autowired
private PersonalTemplateService personalTemplateService;
@Autowired
private PaCustomerService paCustomerService;
@Autowired
private PublicTemplateService publicTemplateService;
@Override
public List<SubscribeCategoryResultDTO> getCategory(SubscribeFormDTO formDTO) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId());
WxGetCategoryResult wxResult = getCategoryResult(authInfo.getAuthorizerAccessToken());
List<SubscribeCategoryResultDTO> list = wxResult.getData().stream().map(category -> {
SubscribeCategoryResultDTO resultDTO = new SubscribeCategoryResultDTO();
resultDTO.setId(category.getId());
resultDTO.setName(category.getName());
return resultDTO;
}).collect(Collectors.toList());
return list;
}
@Override
public PageData getPubTemplateTitles(PubTemplateFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<PubTemplateResultDTO> list = publicTemplateService.getPubTempList(formDTO);
PageInfo<PubTemplateResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
@Override
public void syncPubTemplateTitles(PubTemplateFormDTO formDTO) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId());
//获取类目ID
WxGetCategoryResult wxGetCategoryResult = getCategoryResult(authInfo.getAuthorizerAccessToken());
List<String> idList = wxGetCategoryResult.getData().stream().map(a -> a.getId().toString()).collect(Collectors.toList());
publicTemplateService.deleteTempByCategoryId(idList);
String ids = String.join(",", idList);
WxSubTemplateReq request = new WxSubTemplateReq();
request.setIds(ids);
request.setLimit(NumConstant.THIRTY);
request.setStart(NumConstant.ZERO);
WxResult<WxSubTemplateResult> wxResult = wxMaSubscribeService.getPubTemplateTitles(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
Integer total = wxResult.getData().getCount();
List<PublicTemplateDTO> list = wxResult.getData().getData().stream().map(template -> {
PublicTemplateDTO dto = new PublicTemplateDTO();
dto.setTid(template.getTid().toString());
dto.setTitle(template.getTitle());
dto.setCategoryId(template.getCategoryId());
dto.setType(template.getType().toString());
return dto;
}).collect(Collectors.toList());
if (total > NumConstant.THIRTY) {
for (int i = NumConstant.THIRTY; i < total; i= i + NumConstant.THIRTY) {
request.setStart(i);
wxResult = wxMaSubscribeService.getPubTemplateTitles(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
List<PublicTemplateDTO> pubList = wxResult.getData().getData().stream().map(template -> {
PublicTemplateDTO dto = new PublicTemplateDTO();
dto.setTid(template.getTid().toString());
dto.setTitle(template.getTitle());
dto.setCategoryId(template.getCategoryId());
dto.setType(template.getType().toString());
return dto;
}).collect(Collectors.toList());
list.addAll(pubList);
}
}
publicTemplateService.insertBatch(ConvertUtils.sourceToTarget(list, PublicTemplateEntity.class));
}
@Override
public List<KeyWordsResultDTO> getKeyWords(SubscribeFormDTO formDTO) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId());
WxKeyWordsResult keyWordsResult = getTitleKeyWords(authInfo.getAuthorizerAccessToken(), formDTO.getTitleId());
List<KeyWordsResultDTO> list = keyWordsResult.getData().stream().map(keyWord -> {
KeyWordsResultDTO dto = new KeyWordsResultDTO();
dto.setExample(keyWord.getExample());
dto.setKid(keyWord.getKid());
dto.setName(keyWord.getName());
dto.setRule(keyWord.getRule());
return dto;
}).collect(Collectors.toList());
return list;
}
@Override
public List<GetTemplateResultDTO> getTemplate(SubscribeFormDTO formDTO) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId());
List<PersonalTemplateDTO> list = personalTemplateService.getListByAppId(formDTO.getAppId());
WxResult<WxGetTemplateResult> wxResult = wxMaSubscribeService.getTemplate(authInfo.getAuthorizerAccessToken());
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
List<GetTemplateResultDTO> resultList = new ArrayList<>();
if (null != list && list.size() > 0) {
resultList =
list.stream().flatMap(dto -> wxResult.getData().getData().stream().filter(bean ->
dto.getPriTmplId().equals(bean.getPriTmplId())).map(template -> {
GetTemplateResultDTO tempDTO = new GetTemplateResultDTO();
tempDTO.setPriTmplId(dto.getPriTmplId());
tempDTO.setTitle(dto.getTitle());
tempDTO.setType(dto.getType());
tempDTO.setKidNames(dto.getKeyWords());
tempDTO.setSceneDesc(dto.getSceneDesc());
tempDTO.setContent(template.getContent());
tempDTO.setExample(template.getExample());
return tempDTO;
})).collect(Collectors.toList());
}
return resultList;
}
@Override
public void addTemplate(AddTemplateFormDTO formDTO) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId());
WxAddTemplateReq request = new WxAddTemplateReq();
request.setTid(formDTO.getTid());
request.setKidList(formDTO.getKidList());
request.setSceneDesc(formDTO.getSceneDesc());
WxResult<String> wxResult = wxMaSubscribeService.addTemplate(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
String priTmplId = wxResult.getData();
String keywords = String.join(",", formDTO.getNameList());
List<String> keyIdList = formDTO.getKidList().stream().map(Object::toString).collect(Collectors.toList());
String keyIds = String.join(",", keyIdList);
//将公共模板存入数据库
PersonalTemplateDTO personalTemplateDTO = new PersonalTemplateDTO();
personalTemplateDTO.setCustomerId(authInfo.getCustomerId());
personalTemplateDTO.setClientType(authInfo.getClientType());
personalTemplateDTO.setAppId(formDTO.getAppId());
personalTemplateDTO.setPid(priTmplId);
personalTemplateDTO.setPriTmplId(priTmplId);
personalTemplateDTO.setTid(formDTO.getTid());
personalTemplateDTO.setKeyIds(keyIds);
personalTemplateDTO.setTitle(formDTO.getTitle());
personalTemplateDTO.setSceneDesc(formDTO.getSceneDesc());
personalTemplateDTO.setKeyWords(keywords);
personalTemplateDTO.setType(formDTO.getType());
personalTemplateService.save(personalTemplateDTO);
//获取客户列表
List<PaCustomerDTO> customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId());
List<String> customerNames = new ArrayList<>();
if (null != customerList && customerList.size() > NumConstant.ZERO) {
for (PaCustomerDTO paCustomerDTO : customerList) {
//获取小程序调用令牌
AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType());
if (null == authDTO) {
log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权");
customerNames.add(paCustomerDTO.getCustomerName());
continue;
}
WxResult<String> wxResult1 = wxMaSubscribeService.addTemplate(authDTO.getAuthorizerAccessToken(), request);
if (!wxResult1.success()) {
log.error("客户[" + paCustomerDTO.getCustomerName() + "]添加模板失败,原因:" + wxResult1.getErrorCode() + wxResult1.getErrorMsg());
customerNames.add(paCustomerDTO.getCustomerName());
continue;
}
String tmplId = wxResult1.getData();
PersonalTemplateDTO templateDTO = new PersonalTemplateDTO();
templateDTO.setCustomerId(paCustomerDTO.getId());
templateDTO.setClientType(authInfo.getClientType());
templateDTO.setAppId(authDTO.getAuthorizerAppid());
templateDTO.setPid(priTmplId);
templateDTO.setPriTmplId(tmplId);
templateDTO.setTid(formDTO.getTid());
templateDTO.setKeyIds(keyIds);
templateDTO.setTitle(formDTO.getTitle());
templateDTO.setSceneDesc(formDTO.getSceneDesc());
templateDTO.setKeyWords(keywords);
templateDTO.setType(formDTO.getType());
personalTemplateService.save(templateDTO);
}
}
if (customerNames.size() > NumConstant.ZERO) {
String names = String.join(",", customerNames);
throw new RenException("客户[" + names + "]添加模板失败");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delTemplate(DelTemplateFormDTO formDTO) {
List<PersonalTemplateDTO> list = personalTemplateService.getListByPid(formDTO.getPriTmplId());
for (PersonalTemplateDTO dto : list) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(dto.getCustomerId(), dto.getClientType());
if (null == authInfo) {
log.error("客户[" + dto.getCustomerId() + "]未授权");
continue;
}
WxDelTemplateReq request = new WxDelTemplateReq();
request.setPriTmplId(dto.getPriTmplId());
WxResult wxResult = wxMaSubscribeService.delTemplate(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
personalTemplateService.deleteById(dto.getId());
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void init(InitFormDTO formDTO) {
if (null != formDTO.getResiTempIdList() && !formDTO.getResiTempIdList().isEmpty()) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "resi");
if (null == authInfo) {
throw new RenException("居民端未授权或token已过期");
}
formDTO.getResiTempIdList().forEach(tempId -> {
PersonalTemplateDTO templateDTO = personalTemplateService.get(tempId);
List<String> keyIds = Arrays.asList(templateDTO.getKeyIds().split(","));
List<Integer> keyIdList = keyIds.stream().map(Integer::parseInt).collect(Collectors.toList());
WxAddTemplateReq request = new WxAddTemplateReq();
request.setTid(templateDTO.getTid());
request.setKidList(keyIdList);
request.setSceneDesc(templateDTO.getSceneDesc());
WxResult<String> wxResult = wxMaSubscribeService.addTemplate(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
log.error("居民端添加模板失败,原因:" + wxResult.getErrorCode() + wxResult.getErrorMsg());
return;
}
String tmplId = wxResult.getData();
PersonalTemplateDTO personalTemplate = ConvertUtils.sourceToTarget(templateDTO, PersonalTemplateDTO.class);
personalTemplate.setPriTmplId(tmplId);
personalTemplate.setCustomerId(formDTO.getCustomerId());
personalTemplate.setClientType("resi");
personalTemplate.setAppId(authInfo.getAuthorizerAppid());
personalTemplateService.save(personalTemplate);
});
}
if (null != formDTO.getWorkTempIdList() && !formDTO.getWorkTempIdList().isEmpty()) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "work");
if (null == authInfo) {
throw new RenException("工作端未授权或token已过期");
}
formDTO.getWorkTempIdList().forEach(tempId -> {
PersonalTemplateDTO templateDTO = personalTemplateService.get(tempId);
List<String> keyIds = Arrays.asList(templateDTO.getKeyIds().split(","));
List<Integer> keyIdList = keyIds.stream().map(Integer::parseInt).collect(Collectors.toList());
WxAddTemplateReq request = new WxAddTemplateReq();
request.setTid(templateDTO.getTid());
request.setKidList(keyIdList);
request.setSceneDesc(templateDTO.getSceneDesc());
WxResult<String> wxResult = wxMaSubscribeService.addTemplate(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
log.error("工作端添加模板失败,原因:" + wxResult.getErrorCode() + wxResult.getErrorMsg());
return;
}
String tmplId = wxResult.getData();
PersonalTemplateDTO personalTemplate = ConvertUtils.sourceToTarget(templateDTO, PersonalTemplateDTO.class);
personalTemplate.setPriTmplId(tmplId);
personalTemplate.setCustomerId(formDTO.getCustomerId());
personalTemplate.setClientType("resi");
personalTemplate.setAppId(authInfo.getAuthorizerAppid());
personalTemplateService.save(personalTemplate);
});
}
}
@Override
public CustomerTempResultDTO getCustomerTemplate(InitFormDTO formDTO) {
CustomerTempResultDTO resultDTO = new CustomerTempResultDTO();
AuthorizationInfoDTO resiAuthDTO = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "resi");
if (null == resiAuthDTO) {
throw new RenException("居民端未授权");
}
WxResult<WxGetTemplateResult> wxResiResult = wxMaSubscribeService.getTemplate(resiAuthDTO.getAuthorizerAccessToken());
if (!wxResiResult.success()) {
throw new RenException(wxResiResult.getErrorCode(), wxResiResult.getErrorMsg());
}
List<String> resiPubTmplIds =
wxResiResult.getData().getData().stream().map(WxGetTemplateResult.DataBean::getPriTmplId).collect(Collectors.toList());
List<TemplateDTO> resiList = personalTemplateService.getListByCustomer(formDTO.getResiAppId(), formDTO.getCustomerId(), "resi");
List<String> resiTmplIds = resiList.stream().map(TemplateDTO::getTmplId).collect(Collectors.toList());
List<String> resiReduce = resiPubTmplIds.stream().filter(item -> !resiTmplIds.contains(item)).collect(Collectors.toList());
resiReduce.forEach(tmplId -> {
WxDelTemplateReq request = new WxDelTemplateReq();
request.setPriTmplId(tmplId);
WxResult wxResult = wxMaSubscribeService.delTemplate(resiAuthDTO.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
log.error("居民端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg());
}
});
resultDTO.setResiList(resiList);
AuthorizationInfoDTO workAuthDTO = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "work");
if (null == workAuthDTO) {
throw new RenException("工作端未授权");
}
WxResult<WxGetTemplateResult> wxWorkResult = wxMaSubscribeService.getTemplate(workAuthDTO.getAuthorizerAccessToken());
if (!wxWorkResult.success()) {
throw new RenException(wxWorkResult.getErrorCode(), wxWorkResult.getErrorMsg());
}
List<String> workPubTmplIds =
wxWorkResult.getData().getData().stream().map(WxGetTemplateResult.DataBean::getPriTmplId).collect(Collectors.toList());
List<TemplateDTO> workList = personalTemplateService.getListByCustomer(formDTO.getWorkAppId(), formDTO.getCustomerId(), "work");
List<String> workTmplIds = workList.stream().map(TemplateDTO::getTmplId).collect(Collectors.toList());
List<String> workReduce = workPubTmplIds.stream().filter(item -> !workTmplIds.contains(item)).collect(Collectors.toList());
workReduce.forEach(tmplId -> {
WxDelTemplateReq request = new WxDelTemplateReq();
request.setPriTmplId(tmplId);
WxResult wxResult = wxMaSubscribeService.delTemplate(resiAuthDTO.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
log.error("工作端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg());
}
});
resultDTO.setWorkList(workList);
return resultDTO;
}
private WxGetCategoryResult getCategoryResult(String accessToken) {
WxResult<WxGetCategoryResult> wxResult = wxMaSubscribeService.getCategory(accessToken);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
return wxResult.getData();
}
private WxKeyWordsResult getTitleKeyWords(String accessToken, String tId) {
WxResult<WxKeyWordsResult> wxResult = wxMaSubscribeService.getPubTemplateKeywords(accessToken, tId);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
return wxResult.getData();
}
public void sync(InitFormDTO formDTO) {
AuthorizationInfoDTO resiAuthDTO = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "resi");
if (null == resiAuthDTO) {
throw new RenException("居民端未授权");
}
AuthorizationInfoDTO workAuthDTO = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "work");
if (null == workAuthDTO) {
throw new RenException("工作端未授权");
}
//居民端初始化
List<PersonalTemplateDTO> resiList = personalTemplateService.getListByAppId(formDTO.getResiAppId());
if (null != resiList && resiList.size() > 0) {
resiList.forEach(templateDTO -> {
List<String> keyIds = Arrays.asList(templateDTO.getKeyIds().split(","));
List<Integer> keyIdList = keyIds.stream().map(Integer::parseInt).collect(Collectors.toList());
WxAddTemplateReq request = new WxAddTemplateReq();
request.setTid(templateDTO.getTid());
request.setKidList(keyIdList);
request.setSceneDesc(templateDTO.getSceneDesc());
WxResult<String> wxResult = wxMaSubscribeService.addTemplate(resiAuthDTO.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
String tmplId = wxResult.getData();
PersonalTemplateDTO personalTemplate = ConvertUtils.sourceToTarget(templateDTO, PersonalTemplateDTO.class);
personalTemplate.setPriTmplId(tmplId);
personalTemplate.setCustomerId(formDTO.getCustomerId());
personalTemplate.setClientType("resi");
personalTemplate.setAppId(resiAuthDTO.getAuthorizerAppid());
personalTemplateService.save(personalTemplate);
});
}
//工作端初始化
List<PersonalTemplateDTO> workList = personalTemplateService.getListByAppId(formDTO.getWorkAppId());
if (null != workList && workList.size() > 0) {
workList.forEach(templateDTO -> {
List<String> keyIds = Arrays.asList(templateDTO.getKeyIds().split(","));
List<Integer> keyIdList = keyIds.stream().map(Integer::parseInt).collect(Collectors.toList());
WxAddTemplateReq request = new WxAddTemplateReq();
request.setTid(templateDTO.getTid());
request.setKidList(keyIdList);
request.setSceneDesc(templateDTO.getSceneDesc());
WxResult<String> wxResult = wxMaSubscribeService.addTemplate(workAuthDTO.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
String tmplId = wxResult.getData();
PersonalTemplateDTO personalTemplate = ConvertUtils.sourceToTarget(templateDTO, PersonalTemplateDTO.class);
personalTemplate.setPriTmplId(tmplId);
personalTemplate.setCustomerId(formDTO.getCustomerId());
personalTemplate.setClientType("work");
personalTemplate.setAppId(workAuthDTO.getAuthorizerAppid());
personalTemplateService.save(personalTemplate);
});
}
}
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxSubscribeConstant.java

@ -0,0 +1,38 @@
package com.epmet.wxapi.constant;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 10:34
*/
public interface WxSubscribeConstant {
/**
* 获取当前帐号所设置的类目信息
*/
String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getcategory";
/**
* 获取模板标题列表
*/
String GET_PUB_TEMPLATE_TITLES_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles";
/**
* 获取模板标题下的关键词库
*/
String GET_KEY_WORDS_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords";
/**
* 组合模板并添加到个人模板库
*/
String ADD_TEMPLATE_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate";
/**
* 获取帐号下的模板列表
*/
String GET_TEMPLATE_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate";
/**
* 删除帐号下的某个模板
*/
String DEL_TEMPLATE_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate";
}

20
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java

@ -519,6 +519,26 @@ public enum WxMaErrorMsgEnum {
CODE_43101(43101, "用户拒绝接受消息,如果用户之前曾经订阅过,则表示用户取消了订阅关系"),
CODE_47003(47003, "模板参数不准确,可能为空或者不满足规则,errmsg会提示具体是哪个字段出错"),
CODE_200011(200011, "此账号已被封禁,无法操作"),
CODE_200012(200012, "个人模板数已达上限,上限25个"),
CODE_200013(200013, "此模板已被封禁,无法选用"),
CODE_200014(200014, "模板 tid 参数错误"),
CODE_200016(200016, "start 参数错误"),
CODE_200017(200017, "limit 参数错误"),
CODE_200018(200018, "类目 ids 缺失"),
CODE_200019(200019, "类目 ids 不合法"),
CODE_200020(200020, "关键词列表 kidList 参数错误"),
CODE_200021(200021, "场景描述 sceneDesc 参数错误"),
;
private int code;

31
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxAddTemplateReq.java

@ -0,0 +1,31 @@
package com.epmet.wxapi.param;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 9:33
*/
@NoArgsConstructor
@Data
public class WxAddTemplateReq implements Serializable {
private static final long serialVersionUID = -9163397048982502051L;
/**
* 模板标题 id
*/
private String tid;
/**
* 关键词id
*/
private String sceneDesc;
/**
* 服务场景描述15个字以内
*/
private List<Integer> kidList;
}

22
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxDelTemplateReq.java

@ -0,0 +1,22 @@
package com.epmet.wxapi.param;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 9:43
*/
@NoArgsConstructor
@Data
public class WxDelTemplateReq implements Serializable {
private static final long serialVersionUID = 195634574947498628L;
/**
* 要删除的模板id
*/
private String priTmplId;
}

16
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java

@ -24,6 +24,8 @@ public class WxExtJson implements Serializable {
private boolean directCommit;
@JSONField(ordinal = 4)
private ExtBean ext;
@JSONField(ordinal = 5)
private WindowBean window;
@NoArgsConstructor
@Data
@ -31,10 +33,12 @@ public class WxExtJson implements Serializable {
@JSONField(ordinal = 1)
private String extAppid;
@JSONField(ordinal = 2)
private String resiName;
private String customerName;
@JSONField(ordinal = 3)
private String workName;
private String resiName;
@JSONField(ordinal = 4)
private String workName;
@JSONField(ordinal = 5)
private FootbarBean footbar;
@NoArgsConstructor
@Data
@ -119,4 +123,12 @@ public class WxExtJson implements Serializable {
}
}
}
@NoArgsConstructor
@Data
public static class WindowBean {
@JSONField(ordinal = 1)
private String navigationBarTitleText;
}
}

30
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxSubTemplateReq.java

@ -0,0 +1,30 @@
package com.epmet.wxapi.param;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/8 16:30
*/
@NoArgsConstructor
@Data
public class WxSubTemplateReq implements Serializable {
private static final long serialVersionUID = 4133480686759651875L;
/**
* 类目 id多个用逗号隔开
*/
private String ids;
/**
* 用于分页表示从 start 开始 0 开始计数
*/
private Integer start;
/**
* 用于分页表示拉取 limit 条记录最大为 30
*/
private Integer limit;
}

41
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxGetCategoryResult.java

@ -0,0 +1,41 @@
package com.epmet.wxapi.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/8 16:03
*/
@NoArgsConstructor
@Data
public class WxGetCategoryResult implements Serializable {
private static final long serialVersionUID = 6785111976796640604L;
/**
* 错误码
*/
private Integer errcode;
/**
* 错误信息
*/
private String errmsg;
/**
* 类目列表
*/
private List<DataBean> data;
@NoArgsConstructor
@Data
public static class DataBean {
/**
* id : 616
*/
private Integer id;
private String name;
}
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxGetTemplateResult.java

@ -0,0 +1,56 @@
package com.epmet.wxapi.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/9 9:36
*/
@NoArgsConstructor
@Data
public class WxGetTemplateResult implements Serializable {
private static final long serialVersionUID = 1796638032203448934L;
/**
* 错误码
*/
private Integer errcode;
/**
* 错误信息
*/
private String errmsg;
/**
* 个人模板列表
*/
private List<DataBean> data;
@NoArgsConstructor
@Data
public static class DataBean {
/**
* 添加至帐号下的模板 id
*/
private String priTmplId;
/**
* 模板标题
*/
private String title;
/**
* 模板内容
*/
private String content;
/**
* 模板内容示例
*/
private String example;
/**
* 模板类型2 代表一次性订阅3 代表长期订阅
*/
private Integer type;
}
}

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

@ -0,0 +1,52 @@
package com.epmet.wxapi.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/8 16:42
*/
@NoArgsConstructor
@Data
public class WxKeyWordsResult implements Serializable {
private static final long serialVersionUID = -7867379425609113193L;
/**
* 错误码
*/
private Integer errcode;
/**
* 错误信息
*/
private String errmsg;
/**
* 关键词列表
*/
private List<DataBean> data;
@NoArgsConstructor
@Data
public static class DataBean {
/**
* 关键词 id
*/
private Integer kid;
/**
* 关键词内容
*/
private String name;
/**
* 关键词内容对应的示例
*/
private String example;
/**
* 参数类型
*/
private String rule;
}
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/result/WxSubTemplateResult.java

@ -0,0 +1,56 @@
package com.epmet.wxapi.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/8 16:12
*/
@NoArgsConstructor
@Data
public class WxSubTemplateResult implements Serializable {
private static final long serialVersionUID = 5581168509440371239L;
/**
* 错误码
*/
private Integer errcode;
/**
* 错误信息
*/
private String errmsg;
/**
* 列表总数
*/
private Integer count;
/**
* 标题列表
*/
private List<DataBean> data;
@NoArgsConstructor
@Data
public static class DataBean {
/**
* 模板标题 id
*/
private Integer tid;
/**
* 模板标题
*/
private String title;
/**
* 模板类型2 为一次性订阅3 为长期订阅
*/
private Integer type;
/**
* 模板所属类目 id
*/
private String categoryId;
}
}

78
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaSubscribeService.java

@ -0,0 +1,78 @@
package com.epmet.wxapi.service;
import com.epmet.wxapi.param.WxAddTemplateReq;
import com.epmet.wxapi.param.WxDelTemplateReq;
import com.epmet.wxapi.param.WxSubTemplateReq;
import com.epmet.wxapi.result.*;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/8 15:55
*/
public interface WxMaSubscribeService {
/**
* 获取当前帐号所设置的类目信息
*
* @param accessToken
* @return com.epmet.wxapi.result.WxResult<com.epmet.wxapi.result.WxGetCategoryResult>
* @author zhaoqifeng
* @date 2020/9/8 16:06
*/
WxResult<WxGetCategoryResult> getCategory(String accessToken);
/**
* 获取模板标题列表
*
* @param accessToken
* @param request
* @return com.epmet.wxapi.result.WxSubTemplateResult
* @author zhaoqifeng
* @date 2020/9/8 16:34
*/
WxResult<WxSubTemplateResult> getPubTemplateTitles(String accessToken, WxSubTemplateReq request);
/**
* 获取模板标题下的关键词库
*
* @param accessToken
* @param tId
* @return com.epmet.wxapi.result.WxResult<com.epmet.wxapi.result.WxKeyWordsResult>
* @author zhaoqifeng
* @date 2020/9/8 16:45
*/
WxResult<WxKeyWordsResult> getPubTemplateKeywords(String accessToken, String tId);
/**
* 组合模板并添加到个人模板库
*
* @param accessToken
* @param request
* @return com.epmet.wxapi.result.WxResult<java.lang.String>
* @author zhaoqifeng
* @date 2020/9/9 9:35
*/
WxResult<String> addTemplate(String accessToken, WxAddTemplateReq request);
/**
* 获取帐号下的模板列表
*
* @param accessToken
* @return com.epmet.wxapi.result.WxResult<com.epmet.wxapi.result.WxGetTemplateResult>
* @author zhaoqifeng
* @date 2020/9/9 9:42
*/
WxResult<WxGetTemplateResult> getTemplate(String accessToken);
/**
* 删除帐号下的某个模板
*
* @param accessToken
* @param request
* @return com.epmet.wxapi.result.WxResult
* @author zhaoqifeng
* @date 2020/9/9 9:44
*/
WxResult delTemplate(String accessToken, WxDelTemplateReq request);
}

146
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaSubscribeServiceImpl.java

@ -0,0 +1,146 @@
package com.epmet.wxapi.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.wxapi.constant.WxSubscribeConstant;
import com.epmet.wxapi.enums.WxMaErrorMsgEnum;
import com.epmet.wxapi.param.WxAddTemplateReq;
import com.epmet.wxapi.param.WxDelTemplateReq;
import com.epmet.wxapi.param.WxSubTemplateReq;
import com.epmet.wxapi.result.*;
import com.epmet.wxapi.service.WxMaSubscribeService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.springframework.stereotype.Service;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/9/8 15:56
*/
@Service
public class WxMaSubscribeServiceImpl implements WxMaSubscribeService {
private static final String ERR_CODE = "errcode";
private static final String ERR_MSG = "errmsg";
@Override
public WxResult<WxGetCategoryResult> getCategory(String accessToken) {
WxResult<WxGetCategoryResult> result = new WxResult<>();
String url = WxSubscribeConstant.GET_CATEGORY_URL + "?" + "access_token=" + accessToken;
Result<String> httpResult = HttpClientManager.getInstance().sendGet(url, null);
if (!httpResult.success()) {
result.setErrorCode(httpResult.getCode());
result.setErrorMsg(httpResult.getMsg());
return result;
}
Gson gson = new Gson();
WxGetCategoryResult getCategoryResult = gson.fromJson(httpResult.getData(), WxGetCategoryResult.class);
result.setErrorCode(getCategoryResult.getErrcode());
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(getCategoryResult.getErrcode()));
result.setData(getCategoryResult);
return result;
}
@Override
public WxResult<WxSubTemplateResult> getPubTemplateTitles(String accessToken, WxSubTemplateReq request) {
WxResult<WxSubTemplateResult> result = new WxResult<>();
String url = WxSubscribeConstant.GET_PUB_TEMPLATE_TITLES_URL + "?" + "access_token=" + accessToken + "&ids=" + request.getIds()
+ "&start=" + request.getStart() + "&limit=" + request.getLimit();
Result<String> httpResult = HttpClientManager.getInstance().sendGet(url, null);
if (!httpResult.success()) {
result.setErrorCode(httpResult.getCode());
result.setErrorMsg(httpResult.getMsg());
return result;
}
Gson gson = new Gson();
WxSubTemplateResult subTemplateResult = gson.fromJson(httpResult.getData(), WxSubTemplateResult.class);
result.setErrorCode(subTemplateResult.getErrcode());
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(subTemplateResult.getErrcode()));
result.setData(subTemplateResult);
return result;
}
@Override
public WxResult<WxKeyWordsResult> getPubTemplateKeywords(String accessToken, String tId) {
WxResult<WxKeyWordsResult> result = new WxResult<>();
String url = WxSubscribeConstant.GET_KEY_WORDS_URL + "?" + "access_token=" + accessToken + "&tid=" + tId;
Result<String> httpResult = HttpClientManager.getInstance().sendGet(url, null);
if (!httpResult.success()) {
result.setErrorCode(httpResult.getCode());
result.setErrorMsg(httpResult.getMsg());
return result;
}
Gson gson = new Gson();
WxKeyWordsResult keyWordsResult = gson.fromJson(httpResult.getData(), WxKeyWordsResult.class);
result.setErrorCode(keyWordsResult.getErrcode());
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(keyWordsResult.getErrcode()));
result.setData(keyWordsResult);
return result;
}
@Override
public WxResult<String> addTemplate(String accessToken, WxAddTemplateReq request) {
WxResult<String> result = new WxResult<>();
String url = WxSubscribeConstant.ADD_TEMPLATE_URL + "?" + "access_token=" + accessToken;
Result<String> httpResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request));
if (!httpResult.success()) {
result.setErrorCode(httpResult.getCode());
result.setErrorMsg(httpResult.getMsg());
return result;
}
JSONObject jsonObject = JSONObject.parseObject(httpResult.getData());
result.setErrorCode(jsonObject.getInteger(ERR_CODE));
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE)));
result.setData(jsonObject.getString("priTmplId"));
return result;
}
@Override
public WxResult<WxGetTemplateResult> getTemplate(String accessToken) {
WxResult<WxGetTemplateResult> result = new WxResult<>();
String url = WxSubscribeConstant.GET_TEMPLATE_URL + "?" + "access_token=" + accessToken;
Result<String> httpResult = HttpClientManager.getInstance().sendGet(url, null);
if (!httpResult.success()) {
result.setErrorCode(httpResult.getCode());
result.setErrorMsg(httpResult.getMsg());
return result;
}
Gson gson = new Gson();
WxGetTemplateResult templateResult = gson.fromJson(httpResult.getData(), WxGetTemplateResult.class);
result.setErrorCode(templateResult.getErrcode());
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(templateResult.getErrcode()));
result.setData(templateResult);
return result;
}
@Override
public WxResult delTemplate(String accessToken, WxDelTemplateReq request) {
WxResult result = new WxResult<>();
String url = WxSubscribeConstant.DEL_TEMPLATE_URL + "?" + "access_token=" + accessToken;
Result<String> httpResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request));
if (!httpResult.success()) {
result.setErrorCode(httpResult.getCode());
result.setErrorMsg(httpResult.getMsg());
return result;
}
JSONObject jsonObject = JSONObject.parseObject(httpResult.getData());
result.setErrorCode(jsonObject.getInteger(ERR_CODE));
result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(jsonObject.getInteger(ERR_CODE)));
return result;
}
private String toJson(Object object) {
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setPrettyPrinting();
Gson gson = gsonBuilder.create();
return gson.toJson(object);
}
}

36
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.10__thirdUpdate.sql

@ -0,0 +1,36 @@
CREATE TABLE `personal_template` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`CLIENT_TYPE` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`APP_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`PID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`PRI_TMPL_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`TYPE` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`TID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`TITLE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`KEY_IDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`KEY_WORDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`SCENE_DESC` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`REVISION` int(11) NULL DEFAULT NULL,
`DEL_FLAG` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`CREATED_TIME` datetime(0) NULL DEFAULT NULL,
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`UPDATED_TIME` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE `public_template` (
`ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`TID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`TITLE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`TYPE` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`CATEGORY_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`REVISION` int(11) NULL DEFAULT NULL,
`DEL_FLAG` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`CREATED_TIME` datetime(0) NULL DEFAULT NULL,
`UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`UPDATED_TIME` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

11
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml

@ -132,5 +132,16 @@
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
</select>
<select id="selectInfoByAppId" resultType="com.epmet.dto.AuthorizationInfoDTO">
SELECT
CUSTOMER_ID,
CLIENT_TYPE,
AUTHORIZER_ACCESS_TOKEN
FROM
authorization_info
WHERE
DEL_FLAG = 0
AND AUTHORIZER_APPID = #{appId}
</select>
</mapper>

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

@ -196,4 +196,16 @@
AND
SOURCE = #{source}
</select>
<select id="selectCustomerListByTestId" resultType="com.epmet.dto.PaCustomerDTO">
SELECT
pc.ID,
pc.CUSTOMER_NAME
FROM
pa_customer pc
INNER JOIN ( SELECT SOURCE FROM pa_customer WHERE ID = #{customerId} ) t ON pc.SOURCE = t.SOURCE
WHERE
pc.DEL_FLAG = 0
AND IS_INITIALIZE = 1
AND pc.ID != #{customerId}
</select>
</mapper>

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

@ -0,0 +1,79 @@
<?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.PersonalTemplateDao">
<resultMap type="com.epmet.entity.PersonalTemplateEntity" id="personalTemplateMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="clientType" column="CLIENT_TYPE"/>
<result property="appId" column="APP_ID"/>
<result property="pid" column="PID"/>
<result property="priTmplId" column="PRI_TMPL_ID"/>
<result property="type" column="TYPE"/>
<result property="title" column="TITLE"/>
<result property="keyWords" column="KEY_WORDS"/>
<result property="sceneDesc" column="SCENE_DESC"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectListByPid" resultType="com.epmet.dto.PersonalTemplateDTO">
SELECT ID,
CUSTOMER_ID,
CLIENT_TYPE,
PRI_TMPL_ID
FROM personal_template
WHERE DEL_FLAG = '0'
AND PID = #{pid}
</select>
<select id="selectListByAppId" resultType="com.epmet.dto.PersonalTemplateDTO">
SELECT *
FROM personal_template
WHERE DEL_FLAG = '0'
AND APP_ID = #{appId}
</select>
<select id="selectSetTemp" resultType="com.epmet.dto.PersonalTemplateDTO">
SELECT ID,
TITLE
FROM personal_template
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND PID = #{pid}
</select>
<select id="selectListByCustomerId" resultType="com.epmet.dto.result.TemplateDTO">
SELECT
t1.ID AS id,
t1.PRI_TMPL_ID AS tmplId,
t1.TITLE AS title,
IF(ISNULL(t2.ID),'0','1') AS state
FROM
(SELECT
ID,
TITLE,
PRI_TMPL_ID
FROM
personal_template
WHERE
DEL_FLAG = '0'
AND APP_ID = #{appId}) t1
LEFT JOIN
(SELECT
ID,
TITLE,
PID,
PRI_TMPL_ID
FROM
personal_template
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}) t2
ON t1.PRI_TMPL_ID = t2.PID
</select>
</mapper>

41
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PublicTemplateDao.xml

@ -0,0 +1,41 @@
<?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.PublicTemplateDao">
<resultMap type="com.epmet.entity.PublicTemplateEntity" id="publicTemplateMap">
<result property="id" column="ID"/>
<result property="tid" column="TID"/>
<result property="title" column="TITLE"/>
<result property="type" column="TYPE"/>
<result property="categoryId" column="CATEGORY_ID"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteTempByCategoryId" parameterType="list">
DELETE FROM public_template WHERE 1=1
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")">
CATEGORY_ID = #{item}
</foreach>
</delete>
<select id="getPubTempList" resultType="com.epmet.dto.result.PubTemplateResultDTO" parameterType="com.epmet.dto.form.PubTemplateFormDTO">
select TID,
TITLE,
TYPE,
CATEGORY_ID
from public_template
where 1=1
<if test="title != null and title.trim() != ''">
AND TITLE LIKE CONCAT('%',#{title},'%')
</if>
<if test="ids != null and ids.trim() != ''">
AND CATEGORY_ID = #{ids}
</if>
</select>
</mapper>
Loading…
Cancel
Save