Browse Source

Merge branch 'dev_temp' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_temp

# Conflicts:
#	epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
#	epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
master
yinzuomei 4 years ago
parent
commit
483958fa1d
  1. 2
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  2. 2
      epmet-cloud-generator/src/main/resources/application.yml
  3. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  4. 46
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  5. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  6. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java
  7. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java
  8. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java
  9. 11
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java
  10. 13
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java
  11. 107
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java
  12. 87
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectDetailDTO.java
  13. 19
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveOrUpdateCustSelPlatformFormDTO.java
  14. 20
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java
  15. 53
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java
  16. 13
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ProjectAssistResult.java
  17. 15
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java
  18. 41
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java
  19. 38
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java
  20. 38
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java
  21. 25
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java
  22. 169
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java
  23. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java
  24. 92
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java
  25. 11
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformBaseResult.java
  26. 13
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java
  27. 53
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java
  28. 92
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java
  29. 41
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java
  30. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java
  31. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java
  32. 46
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java
  33. 52
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java
  34. 56
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java
  35. 55
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java
  36. 71
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java
  37. 46
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java
  38. 19
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java
  39. 25
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java
  40. 38
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  41. 108
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java
  42. 36
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml
  43. 45
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml
  44. 38
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml
  45. 90
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml
  46. 81
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java
  47. 27
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java
  48. 22
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuFormDTO.java
  49. 130
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java
  50. 55
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovCustomerMenuDao.java
  51. 9
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java
  52. 51
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovCustomerMenuEntity.java
  53. 62
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/GovCustomerMenuExcel.java
  54. 47
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java
  55. 126
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovCustomerMenuService.java
  56. 132
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java
  57. 34
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java
  58. 29
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovCustomerMenuDao.xml
  59. 14
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml
  60. 3
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
  61. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
  62. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java
  63. 10
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java
  64. 20
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java
  65. 13
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java
  66. 9
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java
  67. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  68. 61
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java
  69. 8
      epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml
  70. 22
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml
  71. 3
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml
  72. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java
  73. 126
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.java
  74. 136
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java
  75. 7
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java
  76. 39
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/PlatformCallBackFormDTO.java
  77. 5
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java
  78. 55
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java
  79. 35
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java
  80. 11
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java
  81. 9
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java
  82. 42
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java
  83. 21
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java
  84. 11
      epmet-module/gov-project/gov-project-server/pom.xml
  85. 6
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java
  86. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java
  87. 46
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java
  88. 85
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java
  89. 85
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java
  90. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java
  91. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java
  92. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java
  93. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java
  94. 33
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java
  95. 63
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java
  96. 5
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java
  97. 96
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.java
  98. 106
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java
  99. 10
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java
  100. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java

2
epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java

@ -167,7 +167,7 @@ public class SsoServiceImpl implements SsoService {
//test end //test end
if (!result.success() || null == result.getData() || null == result.getData().getUserId()) { if (!result.success() || null == result.getData() || null == result.getData().getUserId()) {
logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在"); logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在,param:{}", JSON.toJSONString(form));
throw new RenException(EpmetErrorCode.ERR10003.getCode()); throw new RenException(EpmetErrorCode.ERR10003.getCode());
} }

2
epmet-cloud-generator/src/main/resources/application.yml

@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置 #MySQL配置
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.1.130:3306/epmet_gov_project?useUnicode=true&characterEncoding=UTF-8&useSSL=false url: jdbc:mysql://192.168.1.130:3306/epmet_third?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet_dba username: epmet_dba
password: EpmEt-dbA-UsEr password: EpmEt-dbA-UsEr
#oracle配置 #oracle配置

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -63,6 +63,10 @@ public interface NumConstant {
String THREE_STR = "3"; String THREE_STR = "3";
String FOUR_STR = "4"; String FOUR_STR = "4";
String FIVE_STR = "5"; String FIVE_STR = "5";
String SIX_STR = "6";
String SEVEN_STR = "7";
String EIGHT_STR = "8";
String NINE_STR = "9";
String POSITIVE_EIGHT_STR = "+8"; String POSITIVE_EIGHT_STR = "+8";
String EMPTY_STR = ""; String EMPTY_STR = "";
String ONE_NEG_STR = "-1"; String ONE_NEG_STR = "-1";

46
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -9,6 +9,7 @@
package com.epmet.commons.tools.redis; package com.epmet.commons.tools.redis;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import org.apache.commons.lang3.StringUtils;
/** /**
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
@ -356,19 +357,52 @@ public class RedisKeys {
/** /**
* @return
* @Description 客户的ApiService
* @author wxz
* @date 2021.01.20 16:56
*/
public static String getCustomerApiServiceKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId);
}
/**
* @return epmet:resi:user:userId
* @Description 用户缓存Key * @Description 用户缓存Key
* @Param 用户Id
* @Author wangc
* @Date 2020.04.13 11:27
**/ **/
public static String getResiUserKey(String userId){ public static String getResiUserKey(String userId) {
return rootPrefix.concat("resi:user:").concat(userId); return rootPrefix.concat("resi:user:").concat(userId);
} }
/** /**
* @Description 客户的ApiService * @param userId
* @return epmet:badge:user:[customerId]:[userId]
* @Description 用户勋章缓存 epmet:badge:user:[customerId]:[userId]
* @author wangc
* @date 2020.11.05 13:34
*/
public static String getResiUserBadgeKey(String customerId, String userId) {
return rootPrefix.concat("badge:user:").concat(customerId).concat(":").concat(StringUtils.isBlank(userId) ? "*" : userId);
}
/**
* 一个客户对应多个第三方平台多个ApiService的key
* @param customerId
* @return * @return
* @author wxz
* @date 2021.01.20 16:56
*/ */
public static String getCustomerApiServiceKey(String customerId) { public static String listCustomerApiServiceListKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId); return rootPrefix.concat("customer:thirdplat:apiservicelist:").concat(customerId);
}
/**
* 查询第三方平台access token
* @param platformId
* @return
*/
public static String getThirdPlatformAccessTokenKey(String platformId) {
return rootPrefix.concat("thirdplatform:accesstoken:").concat(platformId);
} }
} }

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

@ -461,6 +461,7 @@ epmet:
# 内部认证url白名单(在白名单中的,就不会再校验登录了) # 内部认证url白名单(在白名单中的,就不会再校验登录了)
internalAuthUrlsWhiteList: internalAuthUrlsWhiteList:
- /epmetuser/customerstaff/customerlist - /epmetuser/customerstaff/customerlist
- /**/druid/**
# 外部应用认证,使用AccessToken等头进行认证 # 外部应用认证,使用AccessToken等头进行认证
externalOpenUrls: externalOpenUrls:

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java

@ -63,7 +63,7 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
//1.查询用户与党员数据,判断dimId是否为昨天,如果根据这个dimId没有查询出结果,则取前天的数据 //1.查询用户与党员数据,判断dimId是否为昨天,如果根据这个dimId没有查询出结果,则取前天的数据
//如果还是查不出数据,继续向下执行,这部分数据设置默认值 //如果还是查不出数据,继续向下执行,这部分数据设置默认值
//注册用户数 //注册用户数 fact_reg_user_grid_daily 或 fact_reg_user_agency_daily agency级别
List<ScreenUserTotalDataEntity> result = List<ScreenUserTotalDataEntity> result =
factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId);
if(CollectionUtils.isEmpty(result)){ if(CollectionUtils.isEmpty(result)){
@ -72,6 +72,7 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
} }
if(null == result) result = new LinkedList<>(); if(null == result) result = new LinkedList<>();
} }
// 网格级别
List<ScreenUserTotalDataEntity> gridUserResult = List<ScreenUserTotalDataEntity> gridUserResult =
factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId);
@ -84,13 +85,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
result.addAll(gridUserResult); result.addAll(gridUserResult);
} }
//2.组 //2.组 fact_group_grid_daily 或 fact_group_agency_daily
List<ScreenUserTotalDataEntity> agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); List<ScreenUserTotalDataEntity> agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId);
if(CollectionUtils.isEmpty(agencyGroup)){ if(CollectionUtils.isEmpty(agencyGroup)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
} }
} }
// 网格级别
List<ScreenUserTotalDataEntity> gridGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); List<ScreenUserTotalDataEntity> gridGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId);
if(CollectionUtils.isEmpty(gridGroup)){ if(CollectionUtils.isEmpty(gridGroup)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
@ -101,13 +103,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
groupMap.putAll(gridGroup.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getGroupTotal))); groupMap.putAll(gridGroup.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getGroupTotal)));
//3.话题 //3.话题 fact_topic_total_grid_daily或fact_topic_total_agency_daily
List<ScreenUserTotalDataEntity> agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); List<ScreenUserTotalDataEntity> agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId);
if(CollectionUtils.isEmpty(agencyTopic)){ if(CollectionUtils.isEmpty(agencyTopic)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
} }
} }
// 网格级别
List<ScreenUserTotalDataEntity> gridTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); List<ScreenUserTotalDataEntity> gridTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId);
if(CollectionUtils.isEmpty(gridTopic)){ if(CollectionUtils.isEmpty(gridTopic)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
@ -117,13 +120,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
Map<String,Integer> topicMap = agencyTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal)); Map<String,Integer> topicMap = agencyTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal));
topicMap.putAll(gridTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal))); topicMap.putAll(gridTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal)));
//4.议题 //4.议题 fact_issue_grid_daily 或 fact_issue_agency_daily
List<ScreenUserTotalDataEntity> agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); List<ScreenUserTotalDataEntity> agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId);
if(CollectionUtils.isEmpty(agencyIssue)){ if(CollectionUtils.isEmpty(agencyIssue)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
} }
} }
// 网格级别
List<ScreenUserTotalDataEntity> gridIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); List<ScreenUserTotalDataEntity> gridIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId);
if(CollectionUtils.isEmpty(gridIssue)){ if(CollectionUtils.isEmpty(gridIssue)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
@ -133,13 +137,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
Map<String,Integer> issueMap = agencyIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal)); Map<String,Integer> issueMap = agencyIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal));
issueMap.putAll(gridIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal))); issueMap.putAll(gridIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal)));
//5.项目 //5.项目 fact_grid_project_daily 或 fact_agency_project_daily
List<ScreenUserTotalDataEntity> agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); List<ScreenUserTotalDataEntity> agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId);
if(CollectionUtils.isEmpty(agencyProject)){ if(CollectionUtils.isEmpty(agencyProject)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
} }
} }
// 网格级别
List<ScreenUserTotalDataEntity> gridProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); List<ScreenUserTotalDataEntity> gridProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId);
if(CollectionUtils.isEmpty(gridProject)){ if(CollectionUtils.isEmpty(gridProject)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java

@ -74,7 +74,7 @@ public class TopicServiceImpl implements TopicService {
agencies.forEach(agency -> { agencies.forEach(agency -> {
initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency);
}); });
//计算网格-组-话题映射关系
List<ResiGroupTopicResultDTO> topics = topicDao.selectGroupOrderByGrid(targetDate,customerId); List<ResiGroupTopicResultDTO> topics = topicDao.selectGroupOrderByGrid(targetDate,customerId);
topics.forEach(groupTopic -> { topics.forEach(groupTopic -> {
if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){ if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java

@ -197,12 +197,14 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public InitPointRuleResultDTO initPointRule() { public InitPointRuleResultDTO initPointRule() {
//得到所有客户Id
Result<List<CustomerDTO>> customerListResult = operCrmOpenFeignClient.getAllCustomerList(); Result<List<CustomerDTO>> customerListResult = operCrmOpenFeignClient.getAllCustomerList();
log.info("initPointRule operCrmOpenFeignClient.getAllCustomerList result:{}",JSON.toJSONString(customerListResult)); log.info("initPointRule operCrmOpenFeignClient.getAllCustomerList result:{}",JSON.toJSONString(customerListResult));
if (!customerListResult.success() || CollectionUtils.isEmpty(customerListResult.getData())) { if (!customerListResult.success() || CollectionUtils.isEmpty(customerListResult.getData())) {
throw new RenException("获取所有客户列表失败"); throw new RenException("获取所有客户列表失败");
} }
List<CustomerDTO> customerDTOList = customerListResult.getData(); List<CustomerDTO> customerDTOList = customerListResult.getData();
//获取默认规则列表
List<PointRuleDefaultEntity> ruleDefaultEntities = pointRuleDefaultDao.selectList(null); List<PointRuleDefaultEntity> ruleDefaultEntities = pointRuleDefaultDao.selectList(null);
if (CollectionUtils.isEmpty(ruleDefaultEntities)) { if (CollectionUtils.isEmpty(ruleDefaultEntities)) {
log.warn("initPointRule pointRuleDefaultDao.selectList return empty"); log.warn("initPointRule pointRuleDefaultDao.selectList return empty");
@ -211,15 +213,18 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
List<PointRuleEntity> insertList = new ArrayList<>(); List<PointRuleEntity> insertList = new ArrayList<>();
//获取全部默认规则code集合
List<String> defaultEventCodeList = ruleDefaultEntities.stream().map(PointRuleDefaultEntity :: getEventCode).distinct().collect(Collectors.toList()); List<String> defaultEventCodeList = ruleDefaultEntities.stream().map(PointRuleDefaultEntity :: getEventCode).distinct().collect(Collectors.toList());
//获取所有客户的积分规则
List<PointRuleEntity> customerRule = baseDao.selectList(null); List<PointRuleEntity> customerRule = baseDao.selectList(null);
if(!CollectionUtils.isEmpty(customerRule)){ if(!CollectionUtils.isEmpty(customerRule)){
//key :: customerId || value :: 客户规则集合
Map<String,List<PointRuleEntity>> customerRuleMap = Map<String,List<PointRuleEntity>> customerRuleMap =
customerRule.stream().collect(Collectors.groupingBy(PointRuleEntity :: getCustomerId)); customerRule.stream().collect(Collectors.groupingBy(PointRuleEntity :: getCustomerId));
customerRuleMap.forEach((customerId,ruleList) -> { customerRuleMap.forEach((customerId,ruleList) -> {
if(null != ruleList){ if(null != ruleList){
List<String> event = new LinkedList<>(defaultEventCodeList); List<String> event = new LinkedList<>(defaultEventCodeList);
//取差集 //取差集,event只剩下当前客户没有的积分规则
event.removeAll(ruleList.stream().map(PointRuleEntity :: getEventCode).distinct().collect(Collectors.toList())); event.removeAll(ruleList.stream().map(PointRuleEntity :: getEventCode).distinct().collect(Collectors.toList()));
if(!CollectionUtils.isEmpty(event)){ if(!CollectionUtils.isEmpty(event)){
ruleDefaultEntities.stream().filter(rule -> event.contains(rule.getEventCode())).map(o -> { ruleDefaultEntities.stream().filter(rule -> event.contains(rule.getEventCode())).map(o -> {
@ -238,7 +243,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
}); });
} }
//从未被初始化的customerId //被初始化的customerId
List<String> haveInitCustomerIds = baseDao.selectCustomerIds(); List<String> haveInitCustomerIds = baseDao.selectCustomerIds();
if (haveInitCustomerIds == null) { if (haveInitCustomerIds == null) {
haveInitCustomerIds = new ArrayList<>(); haveInitCustomerIds = new ArrayList<>();
@ -249,6 +254,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl<PointRuleDao, PointRul
if (haveInitCustomerIds.contains(customerDTO.getId())) { if (haveInitCustomerIds.contains(customerDTO.getId())) {
continue; continue;
} }
//对从未被初始化过积分规则的客户进行积分规则初始化
PointRuleEntity entity = ConvertUtils.sourceToTarget(defaultRule, PointRuleEntity.class); PointRuleEntity entity = ConvertUtils.sourceToTarget(defaultRule, PointRuleEntity.class);
entity.setId(""); entity.setId("");
entity.setCreatedBy("INITIALIZATION"); entity.setCreatedBy("INITIALIZATION");

11
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java

@ -0,0 +1,11 @@
package com.epmet.constant;
/**
* api service 常量列表
*/
public interface ApiServiceActions {
// 测试动作
String DEMO_ACTION = "demoAction";
}

13
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java

@ -0,0 +1,13 @@
package com.epmet.constant;
/**
* 第三方平台动作常量
*/
public interface ThirdPlatformActions {
// 获取accessToken
String GET_ACCESS_TOKEN = "GET_ACCESS_TOKEN";
// 项目协助
String PROJECT_ASSIST = "PROJECT_ASSIST";
}

107
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java

@ -0,0 +1,107 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author kamui
*/
@Data
public class ProjectApplyAssistFormDTO implements Serializable {
private static final long serialVersionUID = 2052722763454170462L;
private String customerId;
@NotBlank(message = "平台ID不能为空")
private String platformId;
/**
* 标题
*/
private String title;
/**
* 详细内容
*/
@NotBlank(message = "详细内容不能为空")
private String detail;
/**
* 期望结束时间
*/
private String expectEndTime;
/**
* 图片链接英文逗号分割的字符串
*/
private String imageLink;
/**
* 音频链接英文逗号分割的字符串
*/
private String voiceLink;
/**
* 视频链接英文逗号分割的字符串
*/
private String videoLink;
/**
* 当事人姓名
*/
private String personName;
/**
* 当事人手机
*/
private String mobile;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空")
private String detailAddress;
/**
* 来源需根据调用方传对应的值
* 封面新闻需传群众爆料
* 党建引领传党建引领
*/
@NotBlank(message = "来源不能为空")
private String source;
/**
* 经度
*/
@NotBlank(message = "经度不能为空")
private String longitude;
/**
* 纬度
*/
@NotBlank(message = "纬度不能为空")
private String latitude;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
* 区县
*/
private String area;
/**
* 街道
*/
private String street;
/**
* 社区
*/
private String houseEstate;
/**
* 外部事件id
*/
private String outEventId;
/**
* 外部用户id
*/
private String outUserId;
/**
* 通知接口的地址
*/
private String notifyUrl;
}

87
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectDetailDTO.java

@ -0,0 +1,87 @@
package com.epmet.dto.form;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/18 17:12
*/
@Data
public class ProjectDetailDTO implements Serializable {
private static final long serialVersionUID = -2172640364021337846L;
/**
* 议题标题
*/
private String issueTitle;
/**
* 议题状态(voting 已转项目shift_project 已关闭closed)
*/
private String issueStatus;
/**
* 议题发起人电话
* */
private String issuePublisherMobile;
/**
* 议题建议处理方式
*/
private String issueSuggestion;
/**
* 所属网格(网格所属机关单位名称-网格名称)
*/
private String belongsGridName;
/**
* 议题发起人山东路168-尹女士
*/
private String issueInitiator;
/**
* 话题内容
*/
private String topicContent;
/**
* 图片列表
*/
private List<String> photoList;
/**
* 话题发表人山东路168-尹女士
*/
private String topicPublisher;
/**
* 话题发表时间 (时间戳 毫秒级)
*/
private Long topicPublishTime;
/**
* 话题发表人电话
*/
private String topicPublisherMobile;
/**
* 公开答复
*/
private String publicReply;
/**
* 内部备注
*/
private String internalRemark;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
}
}

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

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.List;
@Data
public class SaveOrUpdateCustSelPlatformFormDTO {
@NotBlank(message = "客户id不能为空")
private String customerId;
@NotBlank(message = "actionKey不能为空")
private String actionKey;
private List<ThirdPlatformFormDTO> platforms;
}

20
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 第三方平台-demo form dto
*/
@Data
public class TPFDemoFormDTO {
private String demoString;
@NotBlank(message = "客户ID不能为空")
private String customerId;
@NotBlank(message = "平台ID不能为空")
private String platformId;
}

53
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java

@ -0,0 +1,53 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class ThirdPlatformFormDTO {
// 根据客户和动作查询分组
public interface ListAvailableByCustomerAndActionGroup {}
// 根据动作查询分组
public interface ListSelectableByCustomerAndActionGroup {}
// 保存客户选中的平台列表
public interface SaveCustomerSelectedPlatformGroup {}
// 列出客户选中的平台列表
public interface ListSelectedPlatforms {}
// 更新客户自定义的平台信息
public interface UpdateCustomizePlatformInfo {}
public interface SaveOrUpdateSelectedPlatformInfo {}
@NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class,
ListSelectedPlatforms.class,
UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String customerId;
@NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class,
ListSelectableByCustomerAndActionGroup.class,
SaveCustomerSelectedPlatformGroup.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String actionKey;
@NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class,
UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String platformId;
@NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String platformName;
@NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class,
SaveOrUpdateSelectedPlatformInfo.class })
private String icon;
}

13
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ProjectAssistResult.java

@ -0,0 +1,13 @@
package com.epmet.dto.result;
import lombok.Data;
@Data
public class ProjectAssistResult {
/**
* 任务id
*/
private String taskId;
}

15
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.result;
import lombok.Data;
@Data
public class ThirdplatformResultDTO {
/**
*
*/
private String platformId;
private String platformName;
private String icon;
}

41
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java

@ -0,0 +1,41 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ProjectDTO;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.ProjectByCreateTopicUserFormDTO;
import com.epmet.dto.form.ProjectListFromDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.fallback.EpmetThirdOpenFeignClientFallback;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
*
* @author zhaoqifeng
* @date 2021/3/18 14:18
*/
// @FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = GovProjectOpenFeignClientFallback.class,url = "localhost:8110")
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdOpenFeignClientFallback.class)
public interface EpmetThirdOpenFeignClient {
/**
* 请求项目协助
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/3/18 11:08
*/
@PostMapping("third/project/apply-assist")
Result applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO);
}

38
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java

@ -0,0 +1,38 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.feign.fallback.ThirdOpenFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class)
//@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class, url = "http://localhost:8110")
public interface ThirdOpenFeignClient {
/**
* @Description 保存或修改客户选中的第三方平台信息
* @return
* @author wxz
* @date 2021.03.19 15:25
*/
@PostMapping("/third/thirdplatform/customer/saveorupdate-selected-platforms")
Result saveOrUpdateSelectedPlatformsInfo(@RequestBody SaveOrUpdateCustSelPlatformFormDTO input);
/**
* 根据客户id和动作列出客户在指定动作下可用的第三方平台
* 用途工作端运营端配置界面
*
* @param input
* @return
*/
@PostMapping("/third/thirdplatform/customer/list-available-platforms-by-action")
Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input);
}

38
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java

@ -0,0 +1,38 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ProjectDTO;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.ProjectByCreateTopicUserFormDTO;
import com.epmet.dto.form.ProjectListFromDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetThirdOpenFeignClient;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.stereotype.Component;
import java.util.List;
/**
*
* @author zhaoqifeng
* @date 2021/3/18 14:17
*/
@Component
public class EpmetThirdOpenFeignClientFallback implements EpmetThirdOpenFeignClient {
/**
* 请求项目协助
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @author zhaoqifeng
* @date 2021/3/18 11:08
*/
@Override
public Result applyAssist(ProjectApplyAssistFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "applyAssist", formDTO);
}
}

25
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java

@ -0,0 +1,25 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.feign.ThirdOpenFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient {
@Override
public Result saveOrUpdateSelectedPlatformsInfo(SaveOrUpdateCustSelPlatformFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveOrUpdateSelectedPlatformsInfo", input);
}
@Override
public Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(ThirdPlatformFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "listAvailablePlatformsByCustomerAndAction", input);
}
}

169
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java

@ -0,0 +1,169 @@
package com.epmet.apiservice;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.constant.ThirdPlatformActions;
import com.epmet.dao.ThirdplatformActionDao;
import com.epmet.dao.ThirdplatformCustomerRegisterDao;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
import com.epmet.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.entity.ThirdplatformEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import java.util.HashMap;
import java.util.Map;
/**
* ApiService对接第三方平台的抽象类每一个子类都对应一个第三方平台每个第三方平台都实现唯一一个子类
* 每一个具体平台的ApiService都是该抽象类的子类选择性实现抽象类中的某些需要实现方法提供具体业务逻辑
* 此抽象类中定义方法的具体返回类型所有子类都要统一使用在具体实现中做转换若是不需要返回返回null即可
*/
public abstract class ApiService {
/**
* @Description 判断该客户是否注册了该平台
* @return true:已注册该平台可以使用false:未注册无法使用
* @author wxz
* @date 2021.03.15 11:09
*/
public boolean isRegistered(String customerId, String platformId) {
ThirdplatformCustomerRegisterDao tpcRegDao = SpringContextUtils.getBean(ThirdplatformCustomerRegisterDao.class);
ThirdplatformCustomerRegisterEntity tpcReg = tpcRegDao.getByCustomerIdAndPlatformId(customerId, platformId);
if (tpcReg == null) {
return false;
}
return true;
}
/**
* 发送get请求目前仅支持GET/POST
* @param platformId
* @param action
* @param params
* @param headers
* @return
*/
public String sendGetRequest(String platformId, String action, Map<String, Object> params, Map<String, Object> headers) {
// 1.获取token
String accessToken = getAccessToken(platformId);
//2.获取url
ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId);
ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class)
.getByPlatformIdAndActionKey(platformId, action);
if (headers == null) {
headers = new HashMap<>();
}
// 填充access token到头当中
headers.put("X-Access-Token", accessToken);
Result<String> result = HttpClientManager.getInstance().sendGet(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()),
thirdplatform.getBaseUrl().startsWith("https://"),
params,
headers);
if (result == null) {
throw new RenException("请求第三方平台,获取AccessToken失败。result为null");
}
if (result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
judgeResultSuccess(result.getData());
return result.getData();
}
/**
* 发送post请求
* @param platformId
* @param action
* @param jsonString
* @param headers
* @return
*/
public String sendPostRequest(String platformId, String action, String jsonString, Map<String, Object> headers) {
// 1.获取token
String accessToken = getAccessToken(platformId);
//2.获取url
ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId);
ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class)
.getByPlatformIdAndActionKey(platformId, action);
if (headers == null) {
headers = new HashMap<>();
}
// 填充access token到头当中
headers.put("X-Access-Token", accessToken);
Result<String> result = HttpClientManager.getInstance().sendPost(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()),
thirdplatform.getBaseUrl().startsWith("https://"),
jsonString,
headers);
if (result == null) {
throw new RenException("请求第三方平台,获取AccessToken失败。result为null");
}
if (result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
judgeResultSuccess(result.getData());
return result.getData();
}
/**
* @Description 获取accessToken由子类具体实现
* @return
* @author wxz
* @date 2021.03.16 13:45
*/
public abstract String getAccessToken(String platformId);
/**
* @Description 判断客户是否注册了指定的平台如果没有注册则抛出异常
* @return
* @author wxz
* @date 2021.03.15 21:39
*/
public void judgeRegistered(String customerId, String platformId) {
if (!isRegistered(customerId, platformId)) {
throw new RenException(String.format("客户:%s没有配置第三方平台:%s", customerId, platformId));
}
}
/**
* @Description demo示例方法
* @return
* @author wxz
* @date 2021.03.15 10:46
*/
public String demoAction(TPFDemoFormDTO tpfDemoFormDTO) {
return "do success !!";
}
/**
* @Description 项目协同处理
* @return 项目协同处理的Result具体的平台返回的结果最终都要转化为这个ProjectAssistResult返回
* @author wxz
* @date 2021.03.16 09:28
*/
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
return null;
}
/**
* @Description 判断第三方平台返回结果成功失败如果失败则抛出异常
* @return
* @author wxz
* @date 2021.03.22 10:32
*/
public abstract void judgeResultSuccess(String stringData);
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java

@ -0,0 +1,38 @@
package com.epmet.apiservice.impl;
import com.epmet.apiservice.ApiService;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.feign.OperCrmOpenFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* demo api service
*/
@Component(value = "demoApiService")
public class DemoApiService extends ApiService {
Logger logger = LoggerFactory.getLogger(DemoApiService.class);
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Override
public String getAccessToken(String platformId) {
return null;
}
@Override
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
logger.info("DemoApiService发送项目协助到第三方平台成功");
return null;
}
@Override
public void judgeResultSuccess(String stringData) {
}
}

92
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java

@ -0,0 +1,92 @@
package com.epmet.apiservice.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.apiservice.ApiService;
import com.epmet.apiservice.result.LZGridPlatformBaseResult;
import com.epmet.apiservice.result.LZGridPlatformProjectAssistResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.constant.ThirdPlatformActions;
import com.epmet.dao.ThirdplatformActionDao;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.HashMap;
/**
* 泸州网格化平台ApiService
*/
@Component("luzhouGridPlatformApiService")
public class LuzhouGridPlatformApiService extends ApiService {
@Override
public String getAccessToken(String platformId) {
RedisTemplate<String, String> rt = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class);
String token = rt.opsForValue().get(RedisKeys.getThirdPlatformAccessTokenKey(platformId));
if (StringUtils.isBlank(token)) {
ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId);
ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class)
.getByPlatformIdAndActionKey(platformId, ThirdPlatformActions.GET_ACCESS_TOKEN);
String baseUrl = thirdplatform.getBaseUrl();
String platformKey = thirdplatform.getPlatformKey();
String platformSecret = thirdplatform.getPlatformSecret();
HashMap<String, Object> params = new HashMap<>();
params.put("appKey", platformKey);
params.put("appSecret", platformSecret);
Result<String> result = HttpClientManager.getInstance().sendGet(baseUrl.concat(actionEntity.getApiUrl()), params);
if (result == null) {
throw new RenException("请求第三方平台,获取AccessToken失败。result为null");
}
if (!result.success()) {
throw new RenException("请求第三方平台,获取AccessToken失败。");
}
judgeResultSuccess(result.getData());
token = result.getData();
rt.opsForValue().set(RedisKeys.getThirdPlatformAccessTokenKey(platformId), token);
}
return token;
}
@Override
public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) {
String platformId = formDTO.getPlatformId();
// 正式调用第三方平台
//String result1 = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null);
// 开发阶段临时写死
String result = "{\"eventId\":\"test-task-id\"}";
ProjectAssistResult projectAssistResult = new ProjectAssistResult();
if (!StringUtils.isBlank(result)) {
// 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是
// 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体,
// 所有apiService都要想办法转化成这个类型。
LZGridPlatformProjectAssistResult lzResult = JSON.parseObject(result, LZGridPlatformProjectAssistResult.class);
// 此处设置为第三方系统返回的唯一id
projectAssistResult.setTaskId(lzResult.getEventId());
}
System.out.println("泸州网格化平台项目协助发送成功");
return projectAssistResult;
}
@Override
public void judgeResultSuccess(String stringData) {
//LZGridPlatformBaseResult;
LZGridPlatformBaseResult result = JSON.parseObject(stringData, LZGridPlatformBaseResult.class);
if (!"200".equalsIgnoreCase(result.getCode())) {
throw new RenException("泸州网格化平台:返回失败结果,错误码:" + result.getCode());
}
}
}

11
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformBaseResult.java

@ -0,0 +1,11 @@
package com.epmet.apiservice.result;
import lombok.Data;
@Data
public class LZGridPlatformBaseResult<R> {
private Boolean success;
private String code;
private R result;
// 有其他内容可直接写上
}

13
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java

@ -0,0 +1,13 @@
package com.epmet.apiservice.result;
import lombok.Data;
@Data
public class LZGridPlatformProjectAssistResult {
/**
* 事件id
*/
private String eventId;
}

53
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java

@ -0,0 +1,53 @@
package com.epmet.controller;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
import com.epmet.service.ProjectService;
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;
/**
* 对接第三方平台业务Project相关的controller
* 我们系统当中每一个需要发送到第三方平台的操作只对应这里的一个方法根据参数传入platformId内部根据配置获取指定的APiService进行具体平台的调用
* 每一个平台都有自己的ApiSerivce
*/
@RestController
@RequestMapping("project")
public class ProjectController {
@Autowired
private ProjectService projectService;
/**
* @Description demo方法
* @return
* @author wxz
* @date 2021.03.15 21:11
*/
@PostMapping("demo-action")
public Result demoAction(@RequestBody TPFDemoFormDTO tpfDemoFormDTO) {
ValidatorUtils.validateEntity(tpfDemoFormDTO);
String r = projectService.demoAction(tpfDemoFormDTO);
return new Result().ok(r);
}
/**
* @Description 请求项目协助
* @return
* @author wxz
* @date 2021.03.15 21:13
*/
@PostMapping("apply-assist")
public Result applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
ProjectAssistResult projectAssistResult = projectService.applyAssist(formDTO);
return new Result().ok(projectAssistResult);
}
}

92
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java

@ -0,0 +1,92 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.service.ThirdPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 第三方平台维护相关api
*/
@RestController
@RequestMapping("thirdplatform")
public class ThirdPlatformController {
@Autowired
private ThirdPlatformService thirdPlatformService;
/**
* 根据客户id和动作列出客户在指定动作下可用的第三方平台
* 用途工作端运营端配置界面
*
* @param input
* @return
*/
@PostMapping("customer/list-available-platforms-by-action")
public Result<List<ThirdplatformResultDTO>> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListAvailableByCustomerAndActionGroup.class);
List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listAvailablePlatformsByCustomerAndAction(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
/**
* @return
* @Description 根据客户id和动作列出客户可选的第三方系统
* @author wxz
* @date 2021.03.18 10:54
*/
@PostMapping("customer/list-selectable-platforms-by-action")
public Result<List<ThirdplatformResultDTO>> listSelectablePlatformsByAction(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListSelectableByCustomerAndActionGroup.class);
List<ThirdplatformResultDTO> platformRegs = thirdPlatformService.listSelectableByCustomerAndActionGroup(input.getCustomerId(), input.getActionKey());
return new Result<List<ThirdplatformResultDTO>>().ok(platformRegs);
}
/**
* @Description 保存客户选中的平台列表
* @return
* @author wxz
* @date 2021.03.18 18:04
*/
@PostMapping("customer/save-selected-platforms")
public Result saveSelectedPlatforms(@RequestBody List<ThirdPlatformFormDTO> input) {
input.stream().forEach(c -> ValidatorUtils.validateEntity(c, ThirdPlatformFormDTO.SaveCustomerSelectedPlatformGroup.class));
thirdPlatformService.saveSelectedPlatforms(input);
return new Result();
}
/**
* @Description 更新客户自定义的平台信息
* @return
* @author wxz
* @date 2021.03.18 23:45
*/
@PostMapping("customer/update-customize-platform-info")
public Result updateCustomizePlatformInfo(@RequestBody ThirdPlatformFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.UpdateCustomizePlatformInfo.class);
thirdPlatformService.updateCustomizePlatformInfo(input);
return new Result();
}
/**
* @Description 保存或修改客户选中的第三方平台信息
* @return
* @author wxz
* @date 2021.03.19 15:25
*/
@PostMapping("customer/saveorupdate-selected-platforms")
public Result saveOrUpdateSelectedPlatformsInfo(@RequestBody SaveOrUpdateCustSelPlatformFormDTO input) {
ValidatorUtils.validateEntity(input);
thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input.getCustomerId(), input.getActionKey(), input.getPlatforms());
return new Result();
}
}

41
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ThirdplatformActionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-15
*/
@Mapper
public interface ThirdplatformActionDao extends BaseDao<ThirdplatformActionEntity> {
/**
* @Description 根据平台id和action操作查询
* @return
* @author wxz
* @date 2021.03.16 13:35
*/
ThirdplatformActionEntity getByPlatformIdAndActionKey(@Param("platformId") String platformId, @Param("action") String action);
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java

@ -0,0 +1,38 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.ThirdplatformCustomerActionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 客户针对指定操作所选用的第三方平台列表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-18
*/
@Mapper
public interface ThirdplatformCustomerActionDao extends BaseDao<ThirdplatformCustomerActionEntity> {
ThirdplatformCustomerActionEntity selectOneEntity(@Param("customerId") String customerId,
@Param("platformId") String platformId,
@Param("actionKey") String actionKey);
int deleteByCustomerIdAndActionKey(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java

@ -0,0 +1,38 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
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 2021-03-15
*/
@Mapper
public interface ThirdplatformCustomerRegisterDao extends BaseDao<ThirdplatformCustomerRegisterEntity> {
ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId);
}

46
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformEntity;
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 2021-03-15
*/
@Mapper
public interface ThirdplatformDao extends BaseDao<ThirdplatformEntity> {
/**
* 动态sql查询
* @param customerId
* @return
*/
List<ThirdplatformResultDTO> listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(@Param("customerId") String customerId, @Param("actionKey") String actionKey);
}

52
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java

@ -0,0 +1,52 @@
/**
* 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 2021-03-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform_action")
public class ThirdplatformActionEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String platformId;
/**
*
*/
private String actionKey;
private String apiUrl;
}

56
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.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.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 2021-03-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform_customer_action")
public class ThirdplatformCustomerActionEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 平台ID
*/
private String platformId;
/**
* 动作key
*/
private String actionKey;
}

55
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java

@ -0,0 +1,55 @@
/**
* 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 2021-03-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("thirdplatform_customer_register")
public class ThirdplatformCustomerRegisterEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String customerId;
/**
*
*/
private String platformId;
private String customizedPlatformName;
private String customizedPlatformIcon;
}

71
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java

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

46
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java

@ -0,0 +1,46 @@
package com.epmet.service;
import com.epmet.apiservice.ApiService;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.entity.ThirdplatformEntity;
/**
* ApiService选择器
*/
public interface ApiServiceSelector {
/**
* @Description 根据platformId查找platform对应的ApiService如果找不到对应的api service则返回null
* @return ApiService
* @author wxz
* @date 2021.03.15 20:59
*/
default ApiService trySelectApiService(String platformId) {
ThirdplatformDao thirdplatformDao = SpringContextUtils.getBean(ThirdplatformDao.class);
ThirdplatformEntity thirdplatform = thirdplatformDao.selectById(platformId);
if (thirdplatform == null) {
return null;
}
return (ApiService)SpringContextUtils.getBean(thirdplatform.getApiService());
}
/**
* @Description 根据platformId查找platform对应的ApiService如果找不到对应的api service则抛出RenException异常
* @return ApiService
* @author wxz
* @date 2021.03.15 21:08
*/
default ApiService selectApiService(String platformId) {
ThirdplatformDao thirdplatformDao = SpringContextUtils.getBean(ThirdplatformDao.class);
ThirdplatformEntity thirdplatform = thirdplatformDao.selectById(platformId);
if (thirdplatform == null) {
throw new RenException(String.format("ID为%s的第三方平台不存在", platformId));
}
return (ApiService)SpringContextUtils.getBean(thirdplatform.getApiService());
}
}

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

@ -0,0 +1,19 @@
package com.epmet.service;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
/**
* 该service用于封装project相关的代码
*/
public interface ProjectService {
String demoAction(TPFDemoFormDTO formDTO);
/**
*
* @param formDTO
*/
ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO);
}

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

@ -0,0 +1,25 @@
package com.epmet.service;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import java.util.List;
public interface ThirdPlatformService {
List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey);
List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey);
/**
* @Description 保存客户选择的平台列表
* @return
* @author wxz
* @date 2021.03.18 22:06
*/
void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms);
void updateCustomizePlatformInfo(ThirdPlatformFormDTO input);
void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List<ThirdPlatformFormDTO> platforms);
}

38
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -0,0 +1,38 @@
package com.epmet.service.impl;
import com.epmet.apiservice.ApiService;
import com.epmet.dto.result.ProjectAssistResult;
import com.epmet.dto.form.ProjectApplyAssistFormDTO;
import com.epmet.dto.form.TPFDemoFormDTO;
import com.epmet.service.ApiServiceSelector;
import com.epmet.service.ProjectService;
import org.springframework.stereotype.Service;
@Service
public class ProjectServiceImpl implements ProjectService, ApiServiceSelector {
@Override
public String demoAction(TPFDemoFormDTO formDTO) {
String customerId = formDTO.getCustomerId();
String platformId = formDTO.getPlatformId();
// 注意,此处会如果找不到对应的ApiService会抛出异常
ApiService apiService = selectApiService(platformId);
apiService.judgeRegistered(customerId, platformId);
return apiService.demoAction(formDTO);
}
@Override
public ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO) {
String customerId = formDTO.getCustomerId();
String platformId = formDTO.getPlatformId();
// 根据平台ID找到注意,此处会如果找不到对应的ApiService会抛出异常
ApiService apiService = selectApiService(platformId);
// 判断该客户是否注册了该平台,如果没有的话,抛出异常
apiService.judgeRegistered(customerId, platformId);
return apiService.projectAssist(formDTO);
}
}

108
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java

@ -0,0 +1,108 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.dao.ThirdplatformCustomerActionDao;
import com.epmet.dao.ThirdplatformCustomerRegisterDao;
import com.epmet.dao.ThirdplatformDao;
import com.epmet.dto.form.ThirdPlatformFormDTO;
import com.epmet.dto.result.ThirdplatformResultDTO;
import com.epmet.entity.ThirdplatformActionEntity;
import com.epmet.entity.ThirdplatformCustomerActionEntity;
import com.epmet.entity.ThirdplatformCustomerRegisterEntity;
import com.epmet.service.ThirdPlatformService;
import jodd.util.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ThirdPlatformServiceImpl implements ThirdPlatformService {
@Autowired
private ThirdplatformDao thirdplatformDao;
@Autowired
private ThirdplatformCustomerActionDao thirdplatformCustomerActionDao;
@Autowired
private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao;
@Override
public List<ThirdplatformResultDTO> listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey) {
return thirdplatformDao.listAvailablePlatformsByCustomerAndAction(customerId, actionKey);
}
@Override
public List<ThirdplatformResultDTO> listSelectableByCustomerAndActionGroup(String customerId, String actionKey) {
return thirdplatformDao.listSelectableByCustomerAndActionGroup(customerId, actionKey);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveSelectedPlatforms(List<ThirdPlatformFormDTO> platforms) {
platforms.forEach(p -> {
ThirdplatformCustomerActionEntity thirdplatformCustomerActionEntity = thirdplatformCustomerActionDao.selectOneEntity(p.getCustomerId(), p.getPlatformId(), p.getActionKey());
if (thirdplatformCustomerActionEntity == null) {
ThirdplatformCustomerActionEntity insert = new ThirdplatformCustomerActionEntity();
insert.setActionKey(p.getActionKey());
insert.setCustomerId(p.getCustomerId());
insert.setPlatformId(p.getPlatformId());
thirdplatformCustomerActionDao.insert(insert);
}
});
}
@Override
public void updateCustomizePlatformInfo(ThirdPlatformFormDTO input) {
ThirdplatformCustomerRegisterEntity exist = thirdplatformCustomerRegisterDao.getByCustomerIdAndPlatformId(input.getCustomerId(), input.getPlatformId());
if (exist != null) {
exist.setCustomizedPlatformName(input.getPlatformName());
exist.setCustomizedPlatformIcon(input.getIcon());
thirdplatformCustomerRegisterDao.updateById(exist);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List<ThirdPlatformFormDTO> platforms) {
// 1.物理删除客户-action所有对应关系
thirdplatformCustomerActionDao.deleteByCustomerIdAndActionKey(customerId, actionKey);
platforms.stream().forEach(pt -> {
// 2.更新用户自定义的平台信息
updateThirdPlatformCustomerRegInfo(customerId, pt);
// 3.重新建立customer-platform-action对应关系
ThirdplatformCustomerActionEntity tpcaEntity = new ThirdplatformCustomerActionEntity();
tpcaEntity.setPlatformId(pt.getPlatformId());
tpcaEntity.setCustomerId(customerId);
tpcaEntity.setActionKey(actionKey);
thirdplatformCustomerActionDao.insert(tpcaEntity);
});
}
/**
* @Description 更新第三方品台客户对应关系
* @return
* @author wxz
* @date 2021.03.19 15:22
*/
private void updateThirdPlatformCustomerRegInfo(String customerId, ThirdPlatformFormDTO platformFormDTO) {
LambdaQueryWrapper<ThirdplatformCustomerRegisterEntity> conditions = new QueryWrapper<ThirdplatformCustomerRegisterEntity>()
.lambda()
.eq(ThirdplatformCustomerRegisterEntity::getCustomerId, customerId)
.eq(ThirdplatformCustomerRegisterEntity::getPlatformId, platformFormDTO.getPlatformId());
ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity();
entity.setCustomizedPlatformName(platformFormDTO.getPlatformName());
entity.setCustomizedPlatformIcon(platformFormDTO.getIcon());
thirdplatformCustomerRegisterDao.update(entity, conditions);
}
}

36
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml

@ -0,0 +1,36 @@
<?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.ThirdplatformActionDao">
<resultMap type="com.epmet.entity.ThirdplatformActionEntity" id="thirdplatformActionMap">
<result property="id" column="ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="actionKey" column="ACTION_KEY"/>
<result property="apiUrl" column="API_URL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<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="getByPlatformIdAndActionKey" resultType="com.epmet.entity.ThirdplatformActionEntity">
select id,
platform_id,
action_key,
api_url,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from thirdplatform_action ta
where ta.PLATFORM_ID = #{platformId}
and ACTION_KEY = #{action}
</select>
</mapper>

45
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml

@ -0,0 +1,45 @@
<?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.ThirdplatformCustomerActionDao">
<resultMap type="com.epmet.entity.ThirdplatformCustomerActionEntity" id="thirdplatformCustomerActionMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="actionKey" column="ACTION_KEY"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<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="deleteByCustomerIdAndActionKey">
delete
from thirdplatform_customer_action
where CUSTOMER_ID = #{customerId}
and ACTION_KEY = #{actionKey}
</delete>
<select id="selectOneEntity" resultType="com.epmet.entity.ThirdplatformCustomerActionEntity">
select tca.id,
tca.customer_id,
tca.platform_id,
tca.action_key,
tca.del_flag,
tca.revision,
tca.created_by,
tca.created_time,
tca.updated_by,
tca.updated_time
from thirdplatform_customer_action tca
where tca.CUSTOMER_ID = #{customerId}
and tca.PLATFORM_ID = #{platformId}
and tca.ACTION_KEY = #{actionKey}
and tca.DEL_FLAG = 0
</select>
</mapper>

38
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml

@ -0,0 +1,38 @@
<?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.ThirdplatformCustomerRegisterDao">
<resultMap type="com.epmet.entity.ThirdplatformCustomerRegisterEntity" id="thirdplatformCustomerRegisterMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="platformId" column="PLATFORM_ID"/>
<result property="customizedPlatformName" column="CUSTOMIZED_PLATFORM_NAME"/>
<result property="customizedPlatformIcon" column="CUSTOMIZED_PLATFORM_ICON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<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="getByCustomerIdAndPlatformId"
resultType="com.epmet.entity.ThirdplatformCustomerRegisterEntity">
select tcr.id,
customer_id,
platform_id,
customized_platform_name,
customized_platform_icon,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from thirdplatform_customer_register tcr
where CUSTOMER_ID = #{customerId}
and PLATFORM_ID = #{platformId}
and DEL_FLAG = 0
</select>
</mapper>

90
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml

@ -0,0 +1,90 @@
<?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.ThirdplatformDao">
<resultMap type="com.epmet.entity.ThirdplatformEntity" id="thirdplatformMap">
<result property="id" column="ID"/>
<result property="platformName" column="PLATFORM_NAME"/>
<result property="platformKey" column="PLATFORM_KEY"/>
<result property="platformSecret" column="PLATFORM_SECRET"/>
<result property="apiService" column="API_SERVICE"/>
<result property="icon" column="ICON"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<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="listDTOS" resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tcr.id,
tcr.customer_id,
tcr.platform_id,
tpf.PLATFORM_NAME,
tpf.ICON,
tcr.del_flag,
tcr.revision,
tcr.created_by,
tcr.created_time,
tcr.updated_by,
tcr.updated_time
from thirdplatform_customer_register tcr
inner join thirdplatform tpf on (tcr.PLATFORM_ID = tpf.ID)
inner join thirdplatform_action ta on (tpf.ID = ta.PLATFORM_ID)
<where>
<if test="customerId != null and customerId != ''">
tcr.CUSTOMER_ID = #{customerId}
</if>
<if test="actionKey != null and actionKey != ''">
and ta.ACTION_KEY = #{actionKey}
</if>
and tcr.DEL_FLAG = 0
and tpf.DEL_FLAG = 0
</where>
</select>
<select id="listAvailablePlatformsByCustomerAndAction"
resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tca.id,
tca.customer_id,
tca.platform_id,
tca.action_key,
tca.del_flag,
tca.revision,
tca.created_by,
tca.created_time,
tca.updated_by,
tca.updated_time,
tcr.CUSTOMIZED_PLATFORM_NAME platformName,
tcr.CUSTOMIZED_PLATFORM_ICON icon
from thirdplatform_customer_action tca
inner join thirdplatform_customer_register tcr
on (tca.CUSTOMER_ID = tcr.CUSTOMER_ID and tca.PLATFORM_ID = tcr.PLATFORM_ID)
where tca.CUSTOMER_ID = #{customerId}
and tca.ACTION_KEY = #{actionKey}
and tca.DEL_FLAG = 0
and tcr.DEL_FLAG = 0
</select>
<select id="listSelectableByCustomerAndActionGroup"
resultType="com.epmet.dto.result.ThirdplatformResultDTO">
select tcr.id,
tcr.customer_id,
tcr.platform_id,
tcr.customized_platform_name platformName,
tcr.customized_platform_icon icon,
tcr.del_flag,
tcr.revision,
tcr.created_by,
tcr.created_time,
tcr.updated_by,
tcr.updated_time
from thirdplatform_customer_register tcr
inner join thirdplatform_action ta on (tcr.PLATFORM_ID = ta.PLATFORM_ID)
where tcr.CUSTOMER_ID = #{customerId}
and ta.ACTION_KEY = #{actionKey}
and tcr.DEL_FLAG = 0
</select>
</mapper>

81
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java

@ -0,0 +1,81 @@
/**
* 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 2021-03-16
*/
@Data
public class GovCustomerMenuDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* gov_menu表主键
*/
private String tableId;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

27
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 菜单配置 - 一菜单 客户
*/
@Data
public class MenuConfigFormDTO implements Serializable {
private static final long serialVersionUID = -2898130727929596798L;
/**
* gov_menu表主键
*/
@NotBlank(message = "菜单ID不能为空")
private String tableId;
/**
* 客户id 列表
*/
@NotBlank(message = "客户id 列表不能为空")
private List<String> customerIds;
}

22
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 菜单基础入参
*/
@Data
public class MenuFormDTO implements Serializable {
private static final long serialVersionUID = -2898130727929596798L;
/**
* gov_menu表主键
*/
@NotBlank(message = "菜单ID不能为空")
private String tableId;
}

130
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java

@ -0,0 +1,130 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.GovCustomerMenuDTO;
import com.epmet.dto.form.MenuConfigFormDTO;
import com.epmet.dto.form.MenuFormDTO;
import com.epmet.excel.GovCustomerMenuExcel;
import com.epmet.service.GovCustomerMenuService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@RestController
@RequestMapping("govcustomermenu")
public class GovCustomerMenuController {
@Autowired
private GovCustomerMenuService govCustomerMenuService;
@GetMapping("page")
public Result<PageData<GovCustomerMenuDTO>> page(@RequestParam Map<String, Object> params){
PageData<GovCustomerMenuDTO> page = govCustomerMenuService.page(params);
return new Result<PageData<GovCustomerMenuDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<GovCustomerMenuDTO> get(@PathVariable("id") String id){
GovCustomerMenuDTO data = govCustomerMenuService.get(id);
return new Result<GovCustomerMenuDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody GovCustomerMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
govCustomerMenuService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody GovCustomerMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
govCustomerMenuService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
govCustomerMenuService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<GovCustomerMenuDTO> list = govCustomerMenuService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, GovCustomerMenuExcel.class);
}
/**
* 给每个客户 配置可见菜单
* 先删除后新增
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 14:15 2021-03-16
**/
@PostMapping("addcustomermenu")
public Result addCustomerMenu(@RequestBody MenuConfigFormDTO formDTO) {
//效验数据
if (StringUtils.isBlank(formDTO.getTableId())) {
throw new RenException("菜单ID不能为空");
}
govCustomerMenuService.saveCustomerMenu(formDTO);
return new Result();
}
/**
* 根据gov_menu表主键查询拥有这项菜单的所有客户(customerIds)
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<java.lang.String>>
* @Author zhangyong
* @Date 16:26 2021-03-16
**/
@PostMapping("getcustomerids")
public Result<List<String>> getcustomerids(@RequestBody MenuFormDTO formDTO){
List<String> data = govCustomerMenuService.getcustomerIds(formDTO.getTableId());
return new Result<List<String>>().ok(data);
}
}

55
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovCustomerMenuDao.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.GovCustomerMenuEntity;
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 2021-03-16
*/
@Mapper
public interface GovCustomerMenuDao extends BaseDao<GovCustomerMenuEntity> {
/**
* 根据gov_menu表主键先清除之前配置的客户信息
*
* @param tableId
* @return void
* @Author zhangyong
* @Date 14:24 2021-03-16
**/
void deleteBatchTableIds(@Param("tableId") String tableId);
/**
* 根据gov_menu表主键查询拥有这项菜单的所有客户(customerIds)
*
* @param tableId
* @return java.util.List<java.lang.String>
* @Author zhangyong
* @Date 16:29 2021-03-16
**/
List<String> selectListcustomerIds(@Param("tableId") String tableId);
}

9
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java

@ -49,4 +49,13 @@ public interface GovMenuDao extends BaseDao<GovMenuEntity> {
* @param pid 父菜单ID * @param pid 父菜单ID
*/ */
List<GovMenuEntity> getListPid(String pid); List<GovMenuEntity> getListPid(String pid);
/**
* 查询客户菜单列表
*
* @param customerId 客户id
* @param type 菜单类型
* @param language 语言
*/
List<GovMenuEntity> getCustomerMenuList(@Param("customerId") String customerId, @Param("type") Integer type, @Param("language") String language);
} }

51
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovCustomerMenuEntity.java

@ -0,0 +1,51 @@
/**
* 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 2021-03-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("gov_customer_menu")
public class GovCustomerMenuEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* gov_menu表主键
*/
private String tableId;
}

62
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/GovCustomerMenuExcel.java

@ -0,0 +1,62 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
public class GovCustomerMenuExcel {
@Excel(name = "主键ID")
private String id;
@Excel(name = "客户ID")
private String customerId;
@Excel(name = "gov_menu表主键")
private String tableId;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

47
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java

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

126
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovCustomerMenuService.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.GovCustomerMenuDTO;
import com.epmet.dto.form.MenuConfigFormDTO;
import com.epmet.entity.GovCustomerMenuEntity;
import java.util.List;
import java.util.Map;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
public interface GovCustomerMenuService extends BaseService<GovCustomerMenuEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<GovCustomerMenuDTO>
* @author generator
* @date 2021-03-16
*/
PageData<GovCustomerMenuDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<GovCustomerMenuDTO>
* @author generator
* @date 2021-03-16
*/
List<GovCustomerMenuDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return GovCustomerMenuDTO
* @author generator
* @date 2021-03-16
*/
GovCustomerMenuDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void save(GovCustomerMenuDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void update(GovCustomerMenuDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-03-16
*/
void delete(String[] ids);
/**
* 给每个客户 配置可见菜单
*
* @param formDTO
* @return void
* @Author zhangyong
* @Date 14:16 2021-03-16
**/
void saveCustomerMenu(MenuConfigFormDTO formDTO);
/**
* 根据gov_menu表主键查询拥有这项菜单的所有客户(customerIds)
*
* @param tableId
* @return java.util.List<java.lang.String>
* @Author zhangyong
* @Date 16:29 2021-03-16
**/
List<String> getcustomerIds(String tableId);
/**
* 根据gov_menu表主键先清除之前配置的客户信息
*
* @param tableId
* @return void
* @Author zhangyong
* @Date 14:24 2021-03-16
**/
void deleteBatchTableIds(String tableId);
}

132
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java

@ -0,0 +1,132 @@
/**
* 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.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.GovCustomerMenuDao;
import com.epmet.dto.GovCustomerMenuDTO;
import com.epmet.dto.form.MenuConfigFormDTO;
import com.epmet.entity.GovCustomerMenuEntity;
import com.epmet.redis.GovCustomerMenuRedis;
import com.epmet.service.GovCustomerMenuService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Service
public class GovCustomerMenuServiceImpl extends BaseServiceImpl<GovCustomerMenuDao, GovCustomerMenuEntity> implements GovCustomerMenuService {
@Autowired
private GovCustomerMenuRedis govCustomerMenuRedis;
@Override
public PageData<GovCustomerMenuDTO> page(Map<String, Object> params) {
IPage<GovCustomerMenuEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, GovCustomerMenuDTO.class);
}
@Override
public List<GovCustomerMenuDTO> list(Map<String, Object> params) {
List<GovCustomerMenuEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, GovCustomerMenuDTO.class);
}
private QueryWrapper<GovCustomerMenuEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<GovCustomerMenuEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public GovCustomerMenuDTO get(String id) {
GovCustomerMenuEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, GovCustomerMenuDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(GovCustomerMenuDTO dto) {
GovCustomerMenuEntity entity = ConvertUtils.sourceToTarget(dto, GovCustomerMenuEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(GovCustomerMenuDTO dto) {
GovCustomerMenuEntity entity = ConvertUtils.sourceToTarget(dto, GovCustomerMenuEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public void saveCustomerMenu(MenuConfigFormDTO formDTO) {
if (NumConstant.ZERO < formDTO.getCustomerIds().size()) {
baseDao.deleteBatchTableIds(formDTO.getTableId());
List<GovCustomerMenuEntity> entities = new ArrayList<>();
for (String customerId : formDTO.getCustomerIds()) {
GovCustomerMenuEntity entity = new GovCustomerMenuEntity();
entity.setCustomerId(customerId);
entity.setTableId(formDTO.getTableId());
entities.add(entity);
}
insertBatch(entities);
}
}
@Override
public List<String> getcustomerIds(String tableId) {
return baseDao.selectListcustomerIds(tableId);
}
@Override
public void deleteBatchTableIds(String tableId) {
baseDao.deleteBatchTableIds(tableId);
}
}

34
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java

@ -35,10 +35,7 @@ import com.epmet.entity.GovMenuEntity;
import com.epmet.enums.MenuTypeEnum; import com.epmet.enums.MenuTypeEnum;
import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.GovMenuRedis; import com.epmet.redis.GovMenuRedis;
import com.epmet.service.GovLanguageService; import com.epmet.service.*;
import com.epmet.service.GovMenuService;
import com.epmet.service.GovResourceService;
import com.epmet.service.GovRoleMenuService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -67,6 +64,8 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
private GovResourceService govResourceService; private GovResourceService govResourceService;
@Autowired @Autowired
private GovLanguageService govLanguageService; private GovLanguageService govLanguageService;
@Autowired
private GovCustomerMenuService govCustomerMenuService;
@Override @Override
public PageData<GovMenuDTO> page(Map<String, Object> params) { public PageData<GovMenuDTO> page(Map<String, Object> params) {
@ -154,6 +153,9 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
//清空当前用户,菜单导航、权限标识 //清空当前用户,菜单导航、权限标识
govMenuRedis.delete(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient()); govMenuRedis.delete(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient());
// 逻辑删除 epmet_gov_access 表中的关联数据
govCustomerMenuService.deleteBatchTableIds(id);
} }
@Override @Override
@ -185,16 +187,31 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
@Override @Override
public List<GovMenuDTO> getUserMenuNavList(TokenDto tokenDto) { public List<GovMenuDTO> getUserMenuNavList(TokenDto tokenDto) {
List<GovMenuDTO> menuList = govMenuRedis.getUserMenuNavList(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient()); List<GovMenuDTO> menuList = govMenuRedis.getUserMenuNavList(tokenDto.getCustomerId(), tokenDto.getApp(), tokenDto.getClient());
if(menuList == null){ if(menuList == null){
menuList = getUserMenuList(tokenDto, MenuTypeEnum.MENU.value()); menuList = getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value());
govMenuRedis.setUserMenuNavList(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient(), menuList); govMenuRedis.setUserMenuNavList(tokenDto.getCustomerId(), tokenDto.getApp(), tokenDto.getClient(), menuList);
} }
return menuList; return menuList;
} }
/**
* 获取客户配置的 菜单信息
*
* @param customerId
* @param type
* @return java.util.List<com.epmet.dto.GovMenuDTO>
* @Author zhangyong
* @Date 15:51 2021-03-16
**/
private List<GovMenuDTO> getCustomerMenuList(String customerId, Integer type) {
List<GovMenuEntity> menuList = baseDao.getCustomerMenuList(customerId, type, HttpContextUtils.getLanguage());
List<GovMenuDTO> dtoList = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class);
return TreeUtils.buildTree(dtoList);
}
@Override @Override
public Set<String> getUserPermissions(TokenDto tokenDto) { public Set<String> getUserPermissions(TokenDto tokenDto) {
//用户权限列表 //用户权限列表
@ -243,5 +260,4 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
private void saveLanguage(String tableId, String fieldName, String fieldValue){ private void saveLanguage(String tableId, String fieldName, String fieldValue){
govLanguageService.saveOrUpdate("gov_menu", tableId, fieldName, fieldValue, HttpContextUtils.getLanguage()); govLanguageService.saveOrUpdate("gov_menu", tableId, fieldName, fieldValue, HttpContextUtils.getLanguage());
} }
}
}

29
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovCustomerMenuDao.xml

@ -0,0 +1,29 @@
<?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.GovCustomerMenuDao">
<resultMap type="com.epmet.entity.GovCustomerMenuEntity" id="govCustomerMenuMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="tableId" column="TABLE_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<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>
<update id="deleteBatchTableIds">
UPDATE gov_customer_menu SET DEL_FLAG = '1'
WHERE DEL_FLAG = '0'
AND TABLE_ID = #{tableId, jdbcType=VARCHAR}
</update>
<select id="selectListcustomerIds" resultType="String">
SELECT CUSTOMER_ID customerId
FROM gov_customer_menu
WHERE del_flag = 0 AND TABLE_ID = #{tableId, jdbcType=VARCHAR}
</select>
</mapper>

14
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml

@ -39,4 +39,18 @@
select * from gov_menu where del_flag = 0 and pid = #{value} select * from gov_menu where del_flag = 0 and pid = #{value}
</select> </select>
<select id="getCustomerMenuList" resultType="com.epmet.entity.GovMenuEntity">
select t1.*, (select lang.field_value from gov_language lang where lang.table_name='gov_menu' and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name
from gov_menu t1
RIGHT JOIN gov_customer_menu m ON t1.id = m.TABLE_ID
where t1.del_flag = 0 AND m.del_flag = 0
<if test="type != null">
and t1.type = #{type}
</if>
<if test="customerId != null">
and m.CUSTOMER_ID = #{customerId}
</if>
order by t1.sort asc
</select>
</mapper> </mapper>

3
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java

@ -275,6 +275,9 @@ public interface GovIssueOpenFeignClient {
@PostMapping("/gov/issue/issue/detail") @PostMapping("/gov/issue/issue/detail")
Result<IssueResultDTO> queryIssueDetail(@RequestBody IssueDetailFormDTO formDTO); Result<IssueResultDTO> queryIssueDetail(@RequestBody IssueDetailFormDTO formDTO);
@PostMapping(value = "/gov/issue/manage/votingissuedetail")
Result<GovIssueDetailResultDTO> votingissuedetail(@RequestBody IssueDetailFormDTO issueDetail);
/** /**
* 获取客户 分类字典 信息 * 获取客户 分类字典 信息
* *

5
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java

@ -240,6 +240,11 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "detail", formDTO); return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "detail", formDTO);
} }
@Override
public Result<GovIssueDetailResultDTO> votingissuedetail(IssueDetailFormDTO issueDetail) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "votingissuedetail", issueDetail);
}
@Override @Override
public Result<List<ProjectCategoryDictResultDTO>> getCustomerCategoryDict(CustomerCategoryDTO customerCategoryDTO) { public Result<List<ProjectCategoryDictResultDTO>> getCustomerCategoryDict(CustomerCategoryDTO customerCategoryDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getCustomerCategoryDict", customerCategoryDTO); return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getCustomerCategoryDict", customerCategoryDTO);

8
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java

@ -115,6 +115,14 @@ public class IssueAuditController {
return new Result<List<ApplicationHistoryWorkResultDTO>>().ok(issueApplicationHistoryService.applicationHistoryWork(applicationHistoryWorkFormDTO)); return new Result<List<ApplicationHistoryWorkResultDTO>>().ok(issueApplicationHistoryService.applicationHistoryWork(applicationHistoryWorkFormDTO));
} }
/**
* @Description 工作端议题审核
* @param token
* @param param
* @return java.lang.String
* @author wangc
* @date 2021.03.19 23:40
*/
@PostMapping("audit") @PostMapping("audit")
public Result<String> audit(@LoginUser TokenDto token, @RequestBody IssueAuditionFormDTO param){ public Result<String> audit(@LoginUser TokenDto token, @RequestBody IssueAuditionFormDTO param){
return new Result<String>().ok(issueService.audit(token,param)); return new Result<String>().ok(issueService.audit(token,param));

10
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java

@ -103,6 +103,14 @@ public interface IssueVoteDetailDao extends BaseDao<IssueVoteDetailEntity> {
* @return com.epmet.dto.form.VoteRedisFormDTO * @return com.epmet.dto.form.VoteRedisFormDTO
* @author wangc * @author wangc
* @date 2021.03.03 18:09 * @date 2021.03.03 18:09
*/
VoteRedisFormDTO selectInfo4Cache(@Param("issueId") String issueId);
/**
* @Description 批量统计出议题的所有支持数和反对数
* @param issueIds
* @return java.util.Set<com.epmet.dto.form.VoteRedisFormDTO>
* @author wangc
* @date 2021.03.18 14:58
*/ */
VoteRedisFormDTO selectInfo4Cache( @Param("issueId") String issueId); List<VoteRedisFormDTO> selectBatchVoteCount(@Param("issueIds")Set<String> issueIds);
} }

20
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java

@ -98,6 +98,7 @@ public class IssueProjectTagDictRedis {
} }
IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null);
//是否传入的类别Id中只包含"其他"分类,因为自定义分类和默认分类排序规则不一样
boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false);
Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>(); Map<String,List<IssueCategoryTagResultDTO>> result = new HashMap<>();
@ -127,10 +128,9 @@ public class IssueProjectTagDictRedis {
result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult);
} }
//默认、自定义标签,只要有一个是空就触发补偿 //查询结果是空就触发补偿
//不信任缓存数据 //不信任缓存数据
if(!CollectionUtils.isEmpty(result) && !CollectionUtils.isEmpty(result.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)) if(!CollectionUtils.isEmpty(result))
&& !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)))
return result; return result;
@ -154,7 +154,7 @@ public class IssueProjectTagDictRedis {
* @Description FIXME 该方法保留默认查询缓存默认和自定义两种标签均按热度排序 * @Description FIXME 该方法保留默认查询缓存默认和自定义两种标签均按热度排序
* FIXME 如果缓存中没有相关数据则进行补偿返回的数据为1默认标签(分类排序) 2自定义标签(热度排序) * FIXME 如果缓存中没有相关数据则进行补偿返回的数据为1默认标签(分类排序) 2自定义标签(热度排序)
* FIXME 补偿机制均是在缓存中存储热度得分因此在业务改变之前不要调用该方法 * FIXME 补偿机制均是在缓存中存储热度得分因此在业务改变之前不要调用该方法
* category为空则补偿全部返回默认标签和自定义标签 * category为空返回默认标签和自定义标签
* category仅包含"其他"这个分类的Id时同上 * category仅包含"其他"这个分类的Id时同上
* category不为空且不只有"其他"这个分类的Id时则返回集合中的类别标签以及自定义标签 * category不为空且不只有"其他"这个分类的Id时则返回集合中的类别标签以及自定义标签
* 默认标签不按照热度排序自定义标签按照热度排序 * 默认标签不按照热度排序自定义标签按照热度排序
@ -358,6 +358,18 @@ public class IssueProjectTagDictRedis {
redisUtils.zSetAdd(key,o); redisUtils.zSetAdd(key,o);
} }
/**
* @Description 给客户下的分类/标签批量增加/减少热度
* param :
* key : 0 代表减一 1 代表加一
* value :
* key : 某一客户下分类/标签的redisKey
* value : 需要修改的分类/标签
* @param param
* @return void
* @author wangc
* @date 2021.03.20 01:04
*/
public void batchIncrScore(Map<String,Map<String,List<IssueCategoryTagResultDTO>>> param){ public void batchIncrScore(Map<String,Map<String,List<IssueCategoryTagResultDTO>>> param){
if(CollectionUtils.isEmpty(param)) return; if(CollectionUtils.isEmpty(param)) return;
redisTemplate.executePipelined((RedisCallback) connection -> { redisTemplate.executePipelined((RedisCallback) connection -> {

13
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.IssueConstant; import com.epmet.constant.IssueConstant;
import com.epmet.dao.IssueVoteDetailDao;
import com.epmet.dto.IssueDTO; import com.epmet.dto.IssueDTO;
import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.VoteRedisFormDTO; import com.epmet.dto.form.VoteRedisFormDTO;
@ -71,6 +72,9 @@ public class IssueVoteDetailRedis {
@Autowired @Autowired
private IssueVoteDetailService issueVoteDetailService; private IssueVoteDetailService issueVoteDetailService;
@Autowired
private IssueVoteDetailDao issueVoteDetailDao;
public void delete(Object[] ids) { public void delete(Object[] ids) {
} }
@ -92,6 +96,9 @@ public class IssueVoteDetailRedis {
redisUtils.delete(IssueConstant.REDIS_KEY +issueId); redisUtils.delete(IssueConstant.REDIS_KEY +issueId);
} }
public void set(VoteRedisFormDTO vote){ public void set(VoteRedisFormDTO vote){
String key = IssueConstant.REDIS_KEY +vote.getIssueId(); String key = IssueConstant.REDIS_KEY +vote.getIssueId();
//bean to map //bean to map
@ -209,10 +216,8 @@ public class IssueVoteDetailRedis {
} }
//如果缓存中没有,去表决详情中计算出实时数据,并放入缓存中 //如果缓存中没有,去表决详情中计算出实时数据,并放入缓存中
//无需查询issue_vote_statistical中的数据,因为不是实时数据,可能不准确,有定时任务会自动同步 //无需查询issue_vote_statistical中的数据,因为不是实时数据,可能不准确,有定时任务会自动同步
VoteRedisFormDTO voteCache = new VoteRedisFormDTO(); VoteRedisFormDTO voteCache = issueVoteDetailDao.selectInfo4Cache(issueId);
voteCache.setIssueId(issueId); if(StringUtils.isBlank(voteCache.getIssueId())) voteCache.setIssueId(issueId);
voteCache.setSupportAmount(issueVoteDetailService.getVotingCount(issueId,IssueConstant.SUPPORT));
voteCache.setOppositionAmount(issueVoteDetailService.getVotingCount(issueId,IssueConstant.OPPOSE));
IssueDTO issue = issueService.get(issueId); IssueDTO issue = issueService.get(issueId);
if(null != issue){ if(null != issue){
CommonGridIdFormDTO gridId = new CommonGridIdFormDTO(); CommonGridIdFormDTO gridId = new CommonGridIdFormDTO();

9
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java

@ -152,7 +152,14 @@ public interface IssueService extends BaseService<IssueEntity> {
* @date 2020.11.19 10:02 * @date 2020.11.19 10:02
*/ */
FirstTopicShiftedToIssueApplicationResultDTO topicShiftedToIssueV2(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO); FirstTopicShiftedToIssueApplicationResultDTO topicShiftedToIssueV2(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO);
/**
* @Description 工作端议题审核
* @param token
* @param param
* @return java.lang.String
* @author wangc
* @date 2021.03.19 23:40
*/
String audit(TokenDto token, IssueAuditionFormDTO param); String audit(TokenDto token, IssueAuditionFormDTO param);
/** /**

8
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java

@ -450,6 +450,14 @@ public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueEntity> imp
return result; return result;
} }
/**
* @Description 工作端议题审核
* @param token
* @param param
* @return java.lang.String
* @author wangc
* @date 2021.03.19 23:40
*/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String audit(TokenDto token, IssueAuditionFormDTO param){ public String audit(TokenDto token, IssueAuditionFormDTO param){

61
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java

@ -51,19 +51,18 @@ import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.service.IssueVoteDetailService; import com.epmet.service.IssueVoteDetailService;
import com.epmet.service.IssueVoteStatisticalService; import com.epmet.service.IssueVoteStatisticalService;
import com.epmet.utils.ModuleConstants; import com.epmet.utils.ModuleConstants;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 议题表决统计表 * 议题表决统计表
@ -259,6 +258,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void syncVotingCacheToDb() { public void syncVotingCacheToDb() {
IssueDTO issueParam = new IssueDTO(); IssueDTO issueParam = new IssueDTO();
// 表决中
issueParam.setIssueStatus(ModuleConstants.ISSUE_STATUS_VOTING); issueParam.setIssueStatus(ModuleConstants.ISSUE_STATUS_VOTING);
//获取所有voting的议题 //获取所有voting的议题
Set<IssueDTO> issues = Set<IssueDTO> issues =
@ -266,17 +266,20 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
if(null == issues || issues.isEmpty()){ if(null == issues || issues.isEmpty()){
return; return;
} }
// 议题ID集合
Set<String> ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet()); Set<String> ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet());
List<String> gridIds = issues.stream().map(IssueDTO::getGridId).distinct().collect(Collectors.toList()); List<String> gridIds = issues.stream().map(IssueDTO::getGridId).distinct().collect(Collectors.toList());
CommonGridIdListFormDTO gridIdList = new CommonGridIdListFormDTO(); CommonGridIdListFormDTO gridIdList = new CommonGridIdListFormDTO();
gridIdList.setGridIds(gridIds); gridIdList.setGridIds(gridIds);
// 根据网格Id查询网格下所有加入组的组员
Result<GridVotableCountResultDTO> votableCountResult = resiGroupFeignClient.votableCounts(gridIdList); Result<GridVotableCountResultDTO> votableCountResult = resiGroupFeignClient.votableCounts(gridIdList);
Map<String,Integer> votableCountMap = null; Map<String,Integer> votableCountMap1 = null;
if(votableCountResult.success() && null != votableCountResult.getData() && null != votableCountResult.getData().getVotableCountMap()){ if(votableCountResult.success() && null != votableCountResult.getData() && null != votableCountResult.getData().getVotableCountMap()){
votableCountMap = votableCountResult.getData().getVotableCountMap(); votableCountMap1 = votableCountResult.getData().getVotableCountMap();
} }
final Map<String,Integer> votableCountMap = votableCountMap1;
//查询指定议题的统计数据
List<IssueVoteStatisticalDTO> statisticalList = List<IssueVoteStatisticalDTO> statisticalList =
baseDao.selectListByIds(ids); baseDao.selectListByIds(ids);
if (null != statisticalList && statisticalList.size() > NumConstant.ZERO) { if (null != statisticalList && statisticalList.size() > NumConstant.ZERO) {
@ -302,12 +305,42 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
baseDao.updateBatchByIssueId(listToUpdate); baseDao.updateBatchByIssueId(listToUpdate);
if (notExistedIds.size() > NumConstant.ZERO) { if (notExistedIds.size() > NumConstant.ZERO) {
//新增
List<IssueVoteStatisticalDTO> toInsert = new ArrayList<>();
Map<String,String> issueGridMap = issues.stream().collect(Collectors.toMap(IssueDTO::getId,IssueDTO::getGridId,(o, n) -> o)); Map<String,String> issueGridMap = issues.stream().collect(Collectors.toMap(IssueDTO::getId,IssueDTO::getGridId,(o, n) -> o));
//新增
List<IssueVoteStatisticalDTO> toInsert = new LinkedList<>();
List<VoteRedisFormDTO> voteList = issueVoteDetailDao.selectBatchVoteCount(notExistedIds);
List<String> votedIssueIds = new ArrayList<>();
if(!CollectionUtils.isEmpty(voteList) && StringUtils.isNotBlank(voteList.get(NumConstant.ZERO).getIssueId())) {
toInsert = voteList.stream().map(o -> {
IssueVoteStatisticalDTO dto = new IssueVoteStatisticalDTO();
dto.setIssueId(o.getIssueId());
dto.setOppositionCount(o.getOppositionAmount());
dto.setSupportCount(o.getSupportAmount());
dto.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(o.getIssueId()))).orElse(NumConstant.ZERO));
dto.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);dto.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM);
return dto;
}).collect(Collectors.toList());
votedIssueIds = voteList.stream().map(VoteRedisFormDTO::getIssueId).collect(Collectors.toList());
}
notExistedIds.removeAll(votedIssueIds);
if(!notExistedIds.isEmpty()){
List<IssueVoteStatisticalDTO> collect = notExistedIds.stream().map(issueId -> {
IssueVoteStatisticalDTO dto = new IssueVoteStatisticalDTO();
dto.setIssueId(issueId);
dto.setSupportCount(NumConstant.ZERO);
dto.setOppositionCount(NumConstant.ZERO);
dto.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(issueId))).orElse(NumConstant.ZERO));
dto.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);dto.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM);
return dto;
}).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(collect)) toInsert.addAll(collect);}
/*
List<IssueAttitudeCountResultDTO> summaryList = issueVoteDetailDao.getVotingSummaryList(notExistedIds); List<IssueAttitudeCountResultDTO> summaryList = issueVoteDetailDao.getVotingSummaryList(notExistedIds);
Map<String, List<IssueAttitudeCountResultDTO>> summaryMap = Map<String, List<IssueAttitudeCountResultDTO>> summaryMap =
summaryList.stream().collect(Collectors.groupingBy(IssueAttitudeCountResultDTO::getIssueId)); summaryList.stream().collect(Collectors.groupingBy(IssueAttitudeCountResultDTO::getIssueId));
for (Map.Entry<String, List<IssueAttitudeCountResultDTO>> entry : summaryMap.entrySet()) { for (Map.Entry<String, List<IssueAttitudeCountResultDTO>> entry : summaryMap.entrySet()) {
IssueVoteStatisticalDTO obj = new IssueVoteStatisticalDTO(); IssueVoteStatisticalDTO obj = new IssueVoteStatisticalDTO();
obj.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM); obj.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);
@ -322,15 +355,15 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
} }
}); });
} else { } else {
obj.setOppositionCount(NumConstant.ZERO); obj.setOppositionCount(NumConstant.ZERO);
obj.setSupportCount(NumConstant.ZERO); obj.setSupportCount(NumConstant.ZERO);
} }
obj.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(entry.getKey()))).orElse(NumConstant.ZERO)); obj.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(entry.getKey()))).orElse(NumConstant.ZERO));
toInsert.add(obj); toInsert.add(obj);
} }
*/
/* Set<String> setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet()); /* Set<String> setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet());
Set<String> issuesNeverVotedIds = new HashSet<String>(); Set<String> issuesNeverVotedIds = new HashSet<String>();
issuesNeverVotedIds.addAll(ids); issuesNeverVotedIds.addAll(ids);
@ -370,11 +403,11 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
} }
}*/ }*/
if(!toInsert.isEmpty())
// 批量插入 // 批量插入
baseDao.insertBatch(toInsert); baseDao.insertBatch(toInsert);
} }
//} //}
//else if (ids.size() < statisiticalIds.size()) { //else if (ids.size() < statisiticalIds.size()) {
//统计数大于议题数,数据出错 //统计数大于议题数,数据出错
//找出多余数据,删除 //找出多余数据,删除
@ -512,7 +545,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl<IssueVoteSt
IssueVoteStatisticalDTO vote = new IssueVoteStatisticalDTO(); IssueVoteStatisticalDTO vote = new IssueVoteStatisticalDTO();
vote.setIssueId(issue.getId()); vote.setIssueId(issue.getId());
VoteRedisFormDTO cache = Optional.ofNullable(issueVoteDetailRedis.getVoteStatistical(issue.getId())).orElse(issueVoteDetailDao.selectInfo4Cache(issue.getId()) ); VoteRedisFormDTO cache = issueVoteDetailRedis.getVoteStatistical(issue.getId());
if(null == cache) continue; if(null == cache) continue;
if(StringUtils.isBlank(cache.getIssueId())) cache.setIssueId(issue.getId()); if(StringUtils.isBlank(cache.getIssueId())) cache.setIssueId(issue.getId());
vote.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM); vote.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);

8
epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml

@ -28,6 +28,14 @@ spring:
url: @spring.datasource.druid.url@ url: @spring.datasource.druid.url@
username: @spring.datasource.druid.username@ username: @spring.datasource.druid.username@
password: @spring.datasource.druid.password@ password: @spring.datasource.druid.password@
#监控页面
stat-view-servlet:
enabled: true
#loginUsername: admin
#loginPassword: admin
allow:
web-stat-filter:
enabled: true
cloud: cloud:
nacos: nacos:
discovery: discovery:

22
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml

@ -67,6 +67,9 @@
ISSUE_VOTE_DETAIL ISSUE_VOTE_DETAIL
WHERE WHERE
del_flag = '0' del_flag = '0'
<foreach collection="ids" item="issueId" open="AND (" separator=" or " close=" )">
issue_id = #{issueId}
</foreach>
GROUP BY GROUP BY
issue_id, issue_id,
attitude attitude
@ -130,7 +133,26 @@
FROM FROM
`issue_vote_detail` `issue_vote_detail`
WHERE WHERE
del_flag = '0' and
issue_id = #{issueId} issue_id = #{issueId}
</select> </select>
<select id="selectBatchVoteCount" resultType="com.epmet.dto.form.VoteRedisFormDTO">
SELECT
issue_id,
count( ATTITUDE = 'opposition' OR NULL ) AS oppositionAmount,
count( ATTITUDE = 'support' OR NULL ) AS supportAmount,
0 as shouldVoteCount
FROM
`issue_vote_detail`
WHERE
del_flag = '0'
<foreach collection="issueIds" item="issueId" open="AND (" separator=" or " close=" )">
issue_id = #{issueId}
</foreach>
</select>
</mapper> </mapper>

3
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml

@ -23,6 +23,9 @@
</resultMap> </resultMap>
<!-- 生成昨日的话题统计信息 --> <!-- 生成昨日的话题统计信息 -->
<!-- 第一个left Join,每个议题,每种状态的投票总次数 【从当前时间-创建时间,天数大于0】-->
<!-- 第二个left Join,每个议题,每种状态的投票次数 【从当前时间-创建时间,1 >= 天数 >0.也就是昨天】-->
<!-- 关闭天数在一天之内包括1天,转项目天数在一天之内包括1天 -->
<select id="getIssueVotingStatistical" resultType="com.epmet.dto.result.IssuesToBeCountedResultDTO"> <select id="getIssueVotingStatistical" resultType="com.epmet.dto.result.IssuesToBeCountedResultDTO">
SELECT SELECT

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java

@ -134,4 +134,9 @@ public class ProjectProcessDTO implements Serializable {
*/ */
private String orgIdPath; private String orgIdPath;
/**
* 是否发送到外部系统
*/
private Integer isSend;
} }

126
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.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 2021-03-17
*/
@Data
public class ProjectSubAttachmentDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 子节点ID
*/
private String subId;
/**
* 事件ID
*/
private String taskId;
/**
* 附件名
*/
private String attachmentName;
/**
* 文件大小 单位b
*/
private Integer attachmentSize;
/**
* 文件格式
*/
private String attachmentFormat;
/**
* 类型
*/
private String attachmentType;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 语音或视频时长
*/
private Integer duration;
/**
* 排序
*/
private Integer sort;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

136
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java

@ -0,0 +1,136 @@
/**
* 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 2021-03-17
*/
@Data
public class ProjectSubProcessDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 节点ID
*/
private String processId;
/**
* 项目人员关联表ID
*/
private String projectStaffId;
/**
* 系统ID
*/
private String platformId;
/**
* 系统名
*/
private String platformName;
/**
* 第三方平台返回的项目关联ID事件Id
*/
private String taskId;
/**
* 事件处理详细内容
*/
private String result;
/**
* 外部状态:1待处理,2待核实,3已上报,4已完结,5处理中,6待分发,7归档,8催办,9超时
*/
private String externalStatus;
/**
* 外部状态描述
*/
private String externalStatusDesc;
/**
* 内部状态:待处理 pending结案closed
*/
private String internalStatus;
/**
* 处理日期
*/
private Date handleDate;
/**
* 处理人姓名
*/
private String handleUserName;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

7
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ParameterFormDTO.java

@ -18,6 +18,10 @@ import java.io.Serializable;
public class ParameterFormDTO implements Serializable { public class ParameterFormDTO implements Serializable {
private static final long serialVersionUID = 6943367994919967821L; private static final long serialVersionUID = 6943367994919967821L;
// 保存第三方平台发送项目协助开关
public interface SaveThirdPlatformSendProjectSwitchGroup {}
/** /**
* 客户ID * 客户ID
*/ */
@ -53,4 +57,7 @@ public class ParameterFormDTO implements Serializable {
*/ */
@NotBlank(message = "设定核算单位天结束时间不能为空", groups = AddGroup.class) @NotBlank(message = "设定核算单位天结束时间不能为空", groups = AddGroup.class)
private String endTime; private String endTime;
@NotBlank(message = "客户发送第三方平台协助请求开关不能为空", groups = SaveThirdPlatformSendProjectSwitchGroup.class)
private String sendProjectSwitch;
} }

39
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/PlatformCallBackFormDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/19 15:08
*/
@Data
public class PlatformCallBackFormDTO implements Serializable {
private static final long serialVersionUID = 6350776148129116395L;
/**
* 事件id
*/
private String eventId;
/**
* 事件新的状态
*/
private String status;
/**
* 事件处理详细内容
*/
private String note;
/**
* 事件处理日期, 时区GMT+8 格式YYYY-MM-dd HH:mm:ss
*/
private String handleDate;
/**
* 事件处理人姓名
*/
private String handleUserName;
/**
* 参数签名签名算法
*/
private String sign;
}

5
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java

@ -22,4 +22,9 @@ public class ProjectDetailFromDTO implements Serializable {
* 用户ID * 用户ID
*/ */
private String userId; private String userId;
/**
* 客户ID
*/
private String customerId;
} }

55
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java

@ -0,0 +1,55 @@
package com.epmet.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/17 14:31
*/
@Data
public class SendToFormDTO implements Serializable {
private static final long serialVersionUID = -2556534032778491105L;
@NotBlank(message = "项目Id不能为空")
private String projectId;
@NotBlank(message = "项目人员关联Id不能为空")
private String projectStaffId;
@Length(max=1000,message = "公开答复内容不能超过1000位")
private String publicReply;
@NotBlank(message = "内部备注不能为空")
@Length(max=1000,message = "内部备注不能超过1000位")
private String internalRemark;
@NotBlank(message = "外部系统ID不能为空")
private String platformId;
@NotBlank(message = "外部系统名不能为空")
private String platformName;
/**
* 部门名
*/
private String departmentName;
private String userId;
@Valid
private List<TickStaffFormDTO> staffList;
/**
* 公开答复对应文件集合
*/
private List<FileDTO> publicFile;
/**
* 内部备注对应文件集合
*/
private List<FileDTO> internalFile;
}

35
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
public class ThirdPlatformConfigFormDTO {
public interface SaveThirdplatformConfig {
}
public interface LoadThirdplatformConfig { }
@NotBlank(message = "客户ID不能为空", groups = {
SaveThirdplatformConfig.class,
LoadThirdplatformConfig.class})
private String customerId;
@NotBlank(message = "项目协助发送开关状态不能为空", groups = {
SaveThirdplatformConfig.class})
private String sendProjectSwitch;
private List<CustomerSelectedPlatform> customerSelectedPlatformList;
@Data
public static class CustomerSelectedPlatform {
private String customerId;
private String platformId;
private String platformName;
private String icon;
}
}

11
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java

@ -13,6 +13,7 @@ import java.util.List;
@Data @Data
public class ProcessListV2ResultDTO implements Serializable { public class ProcessListV2ResultDTO implements Serializable {
private static final long serialVersionUID = 5762152044573235897L;
/** /**
* 项目ID * 项目ID
*/ */
@ -43,10 +44,19 @@ public class ProcessListV2ResultDTO implements Serializable {
*/ */
private String publicReply; private String publicReply;
/**
* 是否发送到外部系统 0否 1是
*/
private Integer isSend;
/** /**
* 内部备注 * 内部备注
*/ */
private String internalRemark; private String internalRemark;
/**
* 子节点
*/
private List<SubProcessDTO> subProcess;
/** /**
* *
@ -68,5 +78,6 @@ public class ProcessListV2ResultDTO implements Serializable {
this.internalRemark = ""; this.internalRemark = "";
this.publicFile = new ArrayList<>(); this.publicFile = new ArrayList<>();
this.internalFile = new ArrayList<>(); this.internalFile = new ArrayList<>();
this.subProcess = new ArrayList<>();
} }
} }

9
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java

@ -60,6 +60,15 @@ public class ProjectDetailResultDTO implements Serializable {
* 当前跟进部门 * 当前跟进部门
*/ */
private List<DepartmentNameListBean> departmentList; private List<DepartmentNameListBean> departmentList;
/**
* 是否能发送到外部系统
*/
private Boolean isSend;
/**
* 当前流转到外部系统的ID
*/
private List<String> platformIds;
@NoArgsConstructor @NoArgsConstructor
@Data @Data

42
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/3/17 14:45
*/
@Data
public class SubProcessDTO implements Serializable {
private static final long serialVersionUID = -3292921180067385861L;
/**
* 外部平台名
*/
private String platformName;
/**
* 处理状态
*/
private String externalStatus;
/**
* 处理时间
*/
private String processTime;
/**
* 处理人
*/
private String handleUserName;
private String subId;
private String processId;
/**
* 处理内容
*/
private String result;
private List<PublicAndInternalFileResultDTO> subFile;
}

21
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class ThirdPlatformConfigResultDTO {
private String sendProjectSwitch;
private List<CustomerSelectedPlatform> customerSelectedPlatformList = new ArrayList<CustomerSelectedPlatform>();
@Data
public static class CustomerSelectedPlatform {
private String customerId;
private String platformId;
private String platformName;
private String icon;
}
}

11
epmet-module/gov-project/gov-project-server/pom.xml

@ -19,6 +19,11 @@
<artifactId>gov-project-client</artifactId> <artifactId>gov-project-client</artifactId>
<version>2.0.0</version> <version>2.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.epmet</groupId> <groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId> <artifactId>epmet-commons-tools</artifactId>
@ -102,6 +107,12 @@
<version>2.0.0</version> <version>2.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-third-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

6
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ParameterKeyConstant.java

@ -53,4 +53,10 @@ public interface ParameterKeyConstant {
*/ */
String END_TIME = "end_time"; String END_TIME = "end_time";
String END_TIME_NAME = "设定核算单位天结束时间"; String END_TIME_NAME = "设定核算单位天结束时间";
/**
* 发送项目协助到第三方平台开关
*/
String THIRD_PLATFORM_PROJECT_SEND = "third_platform_project_send";
String THIRD_PLATFORM_PROJECT_SEND_NAME = "发送外部系统项目协助开关";
} }

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -158,4 +158,6 @@ public interface ProjectConstant {
String INTERNAL = "internal"; String INTERNAL = "internal";
String NOT_EXIST_PROJECT = "未查询带此项目信息......"; String NOT_EXIST_PROJECT = "未查询带此项目信息......";
String EXTERNAL_SYSTEM = "external_system";
} }

46
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java

@ -25,9 +25,12 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.constant.ParameterKeyConstant;
import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO; import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.excel.CustomerProjectParameterExcel; import com.epmet.excel.CustomerProjectParameterExcel;
import com.epmet.service.CustomerProjectParameterService; import com.epmet.service.CustomerProjectParameterService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -135,4 +138,47 @@ public class CustomerProjectParameterController {
return new Result(); return new Result();
} }
/**
* @Description 保存"发送项目协助到第三方平台"开关参数
* @return
* @author wxz
* @date 2021.03.19 13:50
*/
@PostMapping("save-thirdplatform-send-switch")
public Result saveThirdPlatformSendProjectSwitch(@RequestBody ParameterFormDTO input) {
ValidatorUtils.validateEntity(input, ParameterFormDTO.SaveThirdPlatformSendProjectSwitchGroup.class);
String customerId = input.getCustomerId();
String sendProjectSwitch = input.getSendProjectSwitch();
customerProjectParameterService.saveThirdPlatformSendProjectSwitch(customerId, sendProjectSwitch);
return new Result();
}
/**
* @Description 保存项目第三方平台的配置
* @return
* @author wxz
* @date 2021.03.19 17:10
*/
@PostMapping("save-thirdplatform-config")
public Result saveThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.SaveThirdplatformConfig.class);
String customerId = input.getCustomerId();
String sendProjectSwitch = input.getSendProjectSwitch();
List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList = input.getCustomerSelectedPlatformList();
customerProjectParameterService.saveThirdplatformConfig(customerId, sendProjectSwitch, platformList);
return new Result();
}
/**
* @Description 保存项目第三方平台的配置
* @return
* @author wxz
* @date 2021.03.19 17:10
*/
@PostMapping("load-thirdplatform-config")
public Result<ThirdPlatformConfigResultDTO> loadThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) {
ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.LoadThirdplatformConfig.class);
ThirdPlatformConfigResultDTO resultDTO = customerProjectParameterService.loadThirdplatformConfig(input.getCustomerId(), ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND);
return new Result<ThirdPlatformConfigResultDTO>().ok(resultDTO);
}
} }

85
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java

@ -0,0 +1,85 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ProjectSubAttachmentDTO;
import com.epmet.service.ProjectSubAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 外部系统事件附件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@RestController
@RequestMapping("projectsubattachment")
public class ProjectSubAttachmentController {
@Autowired
private ProjectSubAttachmentService projectSubAttachmentService;
@GetMapping("page")
public Result<PageData<ProjectSubAttachmentDTO>> page(@RequestParam Map<String, Object> params){
PageData<ProjectSubAttachmentDTO> page = projectSubAttachmentService.page(params);
return new Result<PageData<ProjectSubAttachmentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ProjectSubAttachmentDTO> get(@PathVariable("id") String id){
ProjectSubAttachmentDTO data = projectSubAttachmentService.get(id);
return new Result<ProjectSubAttachmentDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ProjectSubAttachmentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
projectSubAttachmentService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ProjectSubAttachmentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
projectSubAttachmentService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
projectSubAttachmentService.delete(ids);
return new Result();
}
}

85
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java

@ -0,0 +1,85 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.ProjectSubProcessDTO;
import com.epmet.service.ProjectSubProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 节点事件关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-17
*/
@RestController
@RequestMapping("projectsubprocess")
public class ProjectSubProcessController {
@Autowired
private ProjectSubProcessService projectSubProcessService;
@GetMapping("page")
public Result<PageData<ProjectSubProcessDTO>> page(@RequestParam Map<String, Object> params){
PageData<ProjectSubProcessDTO> page = projectSubProcessService.page(params);
return new Result<PageData<ProjectSubProcessDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ProjectSubProcessDTO> get(@PathVariable("id") String id){
ProjectSubProcessDTO data = projectSubProcessService.get(id);
return new Result<ProjectSubProcessDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ProjectSubProcessDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
projectSubProcessService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ProjectSubProcessDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
projectSubProcessService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
projectSubProcessService.delete(ids);
return new Result();
}
}

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java

@ -64,6 +64,14 @@ public class ProjectTagsController {
return new Result<ProjectTagsDTO>().ok(data); return new Result<ProjectTagsDTO>().ok(data);
} }
/**
* @Description 保存项目与标签的关联并更新标签热度
* @param dto
* @param token
* @return com.epmet.commons.tools.utils.Result
* @author wangc
* @date 2021.03.20 02:34
*/
@PostMapping("save") @PostMapping("save")
public Result save(@RequestBody ProjectTagHookFormDTO dto, @LoginUser TokenDto token){ public Result save(@RequestBody ProjectTagHookFormDTO dto, @LoginUser TokenDto token){
dto.setCustomerId(token.getCustomerId()); dto.setCustomerId(token.getCustomerId());

16
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java

@ -319,5 +319,21 @@ public class ProjectTraceController {
return new Result(); return new Result();
} }
/**
* 发送到外部平台
* @author zhaoqifeng
* @date 2021/3/17 14:34
* @param tokenDTO
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("sendto")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_TRANSFER)
public Result sendTo(@LoginUser TokenDto tokenDTO, @RequestBody SendToFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
projectTraceService.sendTo(tokenDTO, formDTO);
return new Result();
}
} }

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/CustomerProjectParameterDao.java

@ -79,4 +79,14 @@ public interface CustomerProjectParameterDao extends BaseDao<CustomerProjectPara
* @return int * @return int
*/ */
int deleteByCustomer(@Param("customerId") String customerId); int deleteByCustomer(@Param("customerId") String customerId);
/**
* 根据key获取value
* @author zhaoqifeng
* @date 2021/3/17 16:51
* @param customerId
* @param key
* @return java.lang.String
*/
String selectValueByKey(@Param("customerId") String customerId, @Param("key") String key);
} }

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java

@ -86,4 +86,12 @@ public interface ProjectProcessDao extends BaseDao<ProjectProcessEntity> {
* @date 2020/12/21 下午4:18 * @date 2020/12/21 下午4:18
*/ */
List<ProcessListV2ResultDTO> selectProcessList(@Param("projectId")String projectId); List<ProcessListV2ResultDTO> selectProcessList(@Param("projectId")String projectId);
/**
* @Description 查询当前流转到外部系统的ID
* @Param projectId
* @author zxc
* @date 2021/3/19 上午10:18
*/
List<String> selectPlatFormIds(@Param("projectId") String projectId);
} }

33
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java

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

63
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java

@ -0,0 +1,63 @@
/**
* 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.ProjectSubProcessDTO;
import com.epmet.dto.result.SubProcessDTO;
import com.epmet.entity.ProjectSubProcessEntity;
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 2021-03-17
*/
@Mapper
public interface ProjectSubProcessDao extends BaseDao<ProjectSubProcessEntity> {
/**
* @Description 查询最新记录
* @Param projectStaffIds
* @author zxc
* @date 2021/3/18 上午11:17
*/
ProjectSubProcessDTO selectSubProcess(@Param("projectStaffIds") List<String> projectStaffIds);
/**
* @Description 查询进展和附件
* @Param processIds
* @author zxc
* @date 2021/3/18 下午2:57
*/
List<SubProcessDTO> selectSubProcessAndAttachment(@Param("processIds")List<String> processIds);
/**
* 根据platformId查找最新的记录
* @author zhaoqifeng
* @date 2021/3/19 15:26
* @param platformId
* @return com.epmet.dto.ProjectSubProcessDTO
*/
ProjectSubProcessDTO selectSubProcessByPlatformId(@Param("platformId") String platformId);
}

5
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java

@ -108,4 +108,9 @@ public class ProjectProcessEntity extends BaseEpmetEntity {
*/ */
private String orgIdPath; private String orgIdPath;
/**
* 是否发送到外部系统
*/
private Integer isSend;
} }

96
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.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 2021-03-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("project_sub_attachment")
public class ProjectSubAttachmentEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 子节点ID
*/
private String subId;
/**
* 事件ID
*/
private String taskId;
/**
* 附件名
*/
private String attachmentName;
/**
* 文件大小 单位b
*/
private Integer attachmentSize;
/**
* 文件格式
*/
private String attachmentFormat;
/**
* 类型
*/
private String attachmentType;
/**
* 附件地址
*/
private String attachmentUrl;
/**
* 语音或视频时长
*/
private Integer duration;
/**
* 排序
*/
private Integer sort;
}

106
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java

@ -0,0 +1,106 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.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 2021-03-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("project_sub_process")
public class ProjectSubProcessEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 项目ID
*/
private String projectId;
/**
* 节点ID
*/
private String processId;
/**
* 项目人员关联表ID
*/
private String projectStaffId;
/**
* 系统ID
*/
private String platformId;
/**
* 系统名
*/
private String platformName;
/**
* 第三方平台返回的项目关联ID事件Id
*/
private String taskId;
/**
* 事件处理详细内容
*/
private String result;
/**
* 外部状态:1待处理,2待核实,3已上报,4已完结,5处理中,6待分发,7归档,8催办,9超时
*/
private String externalStatus;
/**
* 外部状态描述
*/
private String externalStatusDesc;
/**
* 内部状态:待处理 pending结案closed
*/
private String internalStatus;
/**
* 处理日期
*/
private Date handleDate;
/**
* 处理人姓名
*/
private String handleUserName;
}

10
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java

@ -21,7 +21,9 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.CustomerProjectParameterDTO;
import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ParameterFormDTO;
import com.epmet.dto.form.ThirdPlatformConfigFormDTO;
import com.epmet.dto.result.ParameterResultDTO; import com.epmet.dto.result.ParameterResultDTO;
import com.epmet.dto.result.ThirdPlatformConfigResultDTO;
import com.epmet.entity.CustomerProjectParameterEntity; import com.epmet.entity.CustomerProjectParameterEntity;
import java.util.List; import java.util.List;
@ -166,4 +168,12 @@ public interface CustomerProjectParameterService extends BaseService<CustomerPro
* @return void * @return void
*/ */
void remindDefault(ParameterFormDTO formDTO); void remindDefault(ParameterFormDTO formDTO);
void saveThirdPlatformSendProjectSwitch(String customerId, String sendProjectSwitch);
void saveThirdplatformConfig(String customerId,
String sendProjectSwitch,
List<ThirdPlatformConfigFormDTO.CustomerSelectedPlatform> platformList);
ThirdPlatformConfigResultDTO loadThirdplatformConfig(String customerId, String parameterKey);
} }

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java

@ -159,4 +159,12 @@ public interface ProjectProcessService extends BaseService<ProjectProcessEntity>
**/ **/
void transferV2(TransferFormDTO formDTO); void transferV2(TransferFormDTO formDTO);
/**
* @Description 查询当前流转到外部系统的ID
* @Param projectId
* @author zxc
* @date 2021/3/19 上午10:18
*/
List<String> selectPlatFormIds(String projectId);
} }

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

Loading…
Cancel
Save