Browse Source

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

# Conflicts:
#	epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java
#	epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java
master
liushaowen 5 years ago
parent
commit
66037cc206
  1. 25
      epmet-auth/pom.xml
  2. 21
      epmet-auth/src/main/java/com/epmet/constant/SsoConstant.java
  3. 91
      epmet-auth/src/main/java/com/epmet/controller/SsoController.java
  4. 53
      epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java
  5. 42
      epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginFormDTO.java
  6. 34
      epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java
  7. 57
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdPlatFormDTO.java
  8. 21
      epmet-auth/src/main/java/com/epmet/dto/result/SsoLoginResultDTO.java
  9. 1
      epmet-auth/src/main/java/com/epmet/dto/result/UserTokenResultDTO.java
  10. 50
      epmet-auth/src/main/java/com/epmet/enums/ThirdPlatformEnum.java
  11. 39
      epmet-auth/src/main/java/com/epmet/redis/SsoRedis.java
  12. 45
      epmet-auth/src/main/java/com/epmet/service/SsoService.java
  13. 546
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  14. 14
      epmet-auth/src/main/resources/bootstrap.yml
  15. 5
      epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java
  16. 22
      epmet-commons/epmet-commons-thirdplat/pom.xml
  17. 36
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java
  18. 44
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java
  19. 117
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java
  20. 122
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
  21. 11
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/bean/ThirdPlatUserInfo.java
  22. 28
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/config/ThirdplatConfig.java
  23. 9
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/ApiServiceBeansConstants.java
  24. 14
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/JcetConstants.java
  25. 18
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/PyldConstants.java
  26. 8
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/form/jcet/SsoTicketFormDTO.java
  27. 8
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/form/jcet/SsoTokenFormDTO.java
  28. 13
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetResult.java
  29. 29
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java
  30. 18
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/PyldUserInfoResultDTO.java
  31. 51
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/encrypt/EncryptUtils.java
  32. 15
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/encrypt/SignUtils.java
  33. 13
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/JcetThirdplatProps.java
  34. 14
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/PyldThirdplatProps.java
  35. 18
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java
  36. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java
  37. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java
  38. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  39. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  40. 35
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoScanParamDTO.java
  41. 32
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoTaskDTO.java
  42. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java
  43. 47
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoAsyncScanResultDTO.java
  44. 56
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoScanDetailDTO.java
  45. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java
  46. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyNode.java
  47. 73
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyTreeUtils.java
  48. 34
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  49. 49
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  50. 88
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java
  51. 161
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java
  52. 1
      epmet-commons/pom.xml
  53. 16
      epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java
  54. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  55. 16
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueInfoDTO.java
  56. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java
  57. 19
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java
  58. 25
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectDistributionResultDTO.java
  59. 7
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java
  60. 25
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovProjectController.java
  61. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java
  62. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java
  63. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiTopicDao.java
  64. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
  65. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java
  66. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java
  67. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java
  68. 39
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java
  69. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java
  70. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java
  71. 17
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml
  72. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml
  73. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiTopicDao.xml
  74. 142
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java
  75. 147
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java
  76. 59
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectQuantityOrgMonthlyDTO.java
  77. 21
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/CategoryAnalysisFormDTO.java
  78. 20
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/EfficiencyAnalysisFormDTO.java
  79. 28
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/QueryQuantityMonthlyFormDTO.java
  80. 24
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/ScreenCommonFormDTO.java
  81. 49
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java
  82. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/commonservice/AddAreaCodeDictResultDTO.java
  83. 50
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/AgencyNodeDTO.java
  84. 15
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/BidInfoResultDTO.java
  85. 19
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/ContractResultDTO.java
  86. 36
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/DeptNodeDTO.java
  87. 36
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/GridNodeDTO.java
  88. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/OneListResultDTO.java
  89. 26
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java
  90. 40
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/EfficiencyAnalysisResultDTO.java
  91. 40
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/ProjectQuantityResultDTO.java
  92. 27
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/QueryQuantityMonthlyResultDTO.java
  93. 17
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/constant/ScreenConstant.java
  94. 3
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java
  95. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthBarchartFormDTO.java
  96. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthPieChartFormDTO.java
  97. 19
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDetailFormDTO.java
  98. 21
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDistributionFormDTO.java
  99. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java
  100. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java

25
epmet-auth/pom.xml

@ -18,6 +18,11 @@
</properties>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-thirdplat</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-admin-client</artifactId>
@ -193,6 +198,11 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
<!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>http://101.206.141.251:21006</thirdplat.jcet.domain>
<thirdplat.jcet.appkey>soXDEoM1</thirdplat.jcet.appkey>
<thirdplat.jcet.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.appsecret>
</properties>
</profile>
<profile>
@ -237,6 +247,11 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
<!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>http://101.206.141.251:21006</thirdplat.jcet.domain>
<thirdplat.jcet.appkey>soXDEoM1</thirdplat.jcet.appkey>
<thirdplat.jcet.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.appsecret>
</properties>
</profile>
<profile>
@ -276,6 +291,11 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19
</dingTalk.robot.secret>
<!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>http://101.206.141.251:21006</thirdplat.jcet.domain>
<thirdplat.jcet.appkey>soXDEoM1</thirdplat.jcet.appkey>
<thirdplat.jcet.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.appsecret>
</properties>
</profile>
@ -319,6 +339,11 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1
</dingTalk.robot.secret>
<!--第三方平台,酒城e通-->
<thirdplat.jcet.domain>https://jcytc.lzjczl.com:21009</thirdplat.jcet.domain>
<thirdplat.jcet.appkey>2cy0a9lA</thirdplat.jcet.appkey>
<thirdplat.jcet.appsecret>6hU3PQgxLcXr27SE</thirdplat.jcet.appsecret>
</properties>
</profile>
</profiles>

21
epmet-auth/src/main/java/com/epmet/constant/SsoConstant.java

@ -0,0 +1,21 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2021/1/19 上午10:26
*/
public interface SsoConstant {
/**
* 酒城e通appId
*/
String WINE_CITY_E_OPEN_APP_ID = "64929543";
String USER_INFO_IS_NULL = "【jcetApiService.getUserInfoByTicket(formDTO.getTicket()】结果为空......";
String INSERT_UPDATE_USER_FAILURE = "新增或更新user_weChat失败......";
String USER_ID_IS_NULL = "userId为空,生成token失败......";
String CUSTOMER_ID_IS_NULL = "customerId为空,缓存放置token失败......";
}

91
epmet-auth/src/main/java/com/epmet/controller/SsoController.java

@ -0,0 +1,91 @@
package com.epmet.controller;
import com.epmet.commons.thirdplat.apiservice.jcet.JcetApiService;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.SsoEnteOrgFormDTO;
import com.epmet.dto.form.SsoLoginFormDTO;
import com.epmet.dto.form.SsoLoginOperFormDTO;
import com.epmet.dto.result.SsoLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.SsoService;
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;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:33
*/
@RestController
@RequestMapping("sso")
public class SsoController {
@Autowired
private SsoService ssoService;
@Autowired
private JcetApiService jcetApiService;
/**
* @Description 0泸州app登陆入口得到token
* @Param formDTO
* @author zxc
* @date 2021/1/18 下午4:59
*/
@PostMapping("resi/login")
public Result<SsoLoginResultDTO> ssoLogin(@RequestBody SsoLoginFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoLogin(formDTO));
}
/**
* @Description 0第三方系统跳转至 运营平台登陆接口
* @Param formDTO
* @author zxc
* @date 2021/1/18 下午4:59
*/
@PostMapping("oper/third/login")
public Result<UserTokenResultDTO> thirdLoginOper(@RequestBody SsoLoginOperFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SsoLoginOperFormDTO.ThirdPlatformLoginForm.class);
return new Result<UserTokenResultDTO>().ok(ssoService.thirdLoginOper(formDTO));
}
@PostMapping("test")
public Result<ThirdPlatUserInfo> testssoLogin() {
ThirdPlatUserInfo userInfoByTicket = null;
try {
userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
} catch (Exception e) {
e.printStackTrace();
}
return new Result<ThirdPlatUserInfo>().ok(userInfoByTicket);
}
/**
* @param formDTO
* @Author sun
* @Description 1ticket自动登录获取内部token
**/
@PostMapping("work/login")
public Result<UserTokenResultDTO> ssoWorkLogin(@RequestBody SsoLoginFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
return new Result<UserTokenResultDTO>().ok(ssoService.ssoWorkLogin(formDTO));
}
/**
* @param formDTO
* @Author sun
* @Description 4自动进入组织-返回token
**/
@PostMapping(value = "work/enterorg")
public Result<UserTokenResultDTO> enterOrg(@RequestBody SsoEnteOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SsoEnteOrgFormDTO.AddUserShowGroup.class, SsoEnteOrgFormDTO.AddUserInternalGroup.class);
UserTokenResultDTO userTokenResultDTO = ssoService.enterOrg(formDTO);
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
}

53
epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java

@ -0,0 +1,53 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 4自动进入组织-返回token
* @Author sun
*/
@Data
public class SsoEnteOrgFormDTO implements Serializable {
public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {}
/**
* wxCode
*/
@NotBlank(message = "ticket不能为空",groups = {AddUserInternalGroup.class})
private String ticket;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空",groups = {AddUserShowGroup.class})
private String mobile;
/**
* 选择的组织所属的id
*/
@NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class})
private String customerId;
/**
* 选择的要进入的组织(根组织id)
*/
@NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class})
private String rootAgencyId;
/**
* resi居民段gov工作端
*/
@NotBlank(message = "app不能为空",groups = SsoLoginFormDTO.SsoLoginForm.class)
private String app;
/**
* app居民段app工作端
*/
@NotBlank(message = "client不能为空",groups = SsoLoginFormDTO.SsoLoginForm.class)
private String client;
}

42
epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginFormDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:43
*/
@Data
public class SsoLoginFormDTO implements Serializable {
private static final long serialVersionUID = -6543952487970013031L;
public interface SsoLoginForm{}
/**
* sso票据有效期为300秒
*/
@NotBlank(message = "sso票据不能为空", groups = {SsoLoginForm.class})
private String ticket;
/**
* 三方平台应用AppId
*/
@NotBlank(message = "三方平台应用AppId不能为空",groups = SsoLoginForm.class)
private String appId;
/**
* app类型 resi居民段gov工作端
*/
@NotBlank(message = "app不能为空", groups = SsoLoginForm.class)
private String app;
/**
* app居民段app工作端
*/
@NotBlank(message = "client不能为空", groups = SsoLoginForm.class)
private String client;
}

34
epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:43
*/
@Data
public class SsoLoginOperFormDTO extends LoginCommonFormDTO implements Serializable {
private static final long serialVersionUID = 8711491709544498082L;
public interface ThirdPlatformLoginForm {
}
/**
* 上游系统token
*/
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class})
private String thirdToken;
/**
* 上游系统token
*
* @see com.epmet.enums.ThirdPlatformEnum
*/
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class})
private String platform;
}

57
epmet-auth/src/main/java/com/epmet/dto/form/ThirdPlatFormDTO.java

@ -0,0 +1,57 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:43
*/
@Data
public class ThirdPlatFormDTO implements Serializable {
private static final long serialVersionUID = -6543952487970013031L;
public interface SsoLoginForm {
}
public interface ThirdPlatformLoginForm {
}
/**
* sso票据有效期为300秒
*/
@NotBlank(message = "sso票据不能为空", groups = {SsoLoginForm.class, ThirdPlatformLoginForm.class})
private String ticket;
/**
* 三方平台应用AppId
*/
@NotBlank(message = "三方平台应用AppId不能为空", groups = SsoLoginForm.class)
private String appId;
/**
* app类型 resi居民段work工作端
*/
@NotBlank(message = "app不能为空", groups = SsoLoginForm.class)
private String app;
@NotBlank(message = "client不能为空", groups = SsoLoginForm.class)
private String client;
/**
* 上游系统token
*/
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class})
private String thirdToken;
/**
* 上游系统token
*
* @see com.epmet.enums.ThirdPlatformEnum
*/
@NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class})
private String platform;
}

21
epmet-auth/src/main/java/com/epmet/dto/result/SsoLoginResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:45
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SsoLoginResultDTO implements Serializable {
private static final long serialVersionUID = 3491079788196180035L;
private String token = "";
}

1
epmet-auth/src/main/java/com/epmet/dto/result/UserTokenResultDTO.java

@ -17,4 +17,5 @@ public class UserTokenResultDTO implements Serializable {
* 令牌
*/
private String token;
private String customerId;
}

50
epmet-auth/src/main/java/com/epmet/enums/ThirdPlatformEnum.java

@ -0,0 +1,50 @@
package com.epmet.enums;
/**
* 系统环境变量枚举类
* dev|test|prod
*
* @author jianjun liu
* @date 2020-07-03 11:14
**/
public enum ThirdPlatformEnum {
/**
* 平阴联动指挥平台
*/
PINGYIN_LIANDONG("pyld", "平阴联动指挥平台", "pyldApiService"),
;
private String code;
private String name;
private String apiService;
ThirdPlatformEnum(String code, String name, String apiService) {
this.code = code;
this.name = name;
this.apiService = apiService;
}
public static ThirdPlatformEnum getEnum(String code) {
ThirdPlatformEnum[] values = ThirdPlatformEnum.values();
for (ThirdPlatformEnum value : values) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
public String getApiService() {
return apiService;
}
}

39
epmet-auth/src/main/java/com/epmet/redis/SsoRedis.java

@ -0,0 +1,39 @@
package com.epmet.redis;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.TokenDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2021/1/18 下午5:09
*/
@Component
public class SsoRedis {
@Autowired
private RedisUtils redisUtils;
/**
* @Description token放入缓存
* @Param user
* @Param expire
* @author zxc
* @date 2021/1/18 下午5:10
*/
public void set(TokenDto user, long expire) {
if (user == null) {
return;
}
String key = RedisKeys.getCpUserKey(user.getApp(), user.getClient(), user.getUserId());
//bean to map
Map<String, Object> map = BeanUtil.beanToMap(user, false, true);
redisUtils.hMSet(key, map, expire);
}
}

45
epmet-auth/src/main/java/com/epmet/service/SsoService.java

@ -0,0 +1,45 @@
package com.epmet.service;
import com.epmet.dto.form.SsoEnteOrgFormDTO;
import com.epmet.dto.form.SsoLoginFormDTO;
import com.epmet.dto.form.SsoLoginOperFormDTO;
import com.epmet.dto.result.SsoLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:34
*/
public interface SsoService {
/**
* @Description 0入口得到token
* @Param formDTO
* @author zxc
* @date 2021/1/18 下午4:59
*/
SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO);
/**
* @param formDTO
* @Author sun
* @Description 1ticket自动登录获取内部token
**/
UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO);
/**
* @param formDTO
* @Author sun
* @Description 4自动进入组织-返回token
**/
UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO);
/**
* desc: sso登陆运营端
*
* @param formDTO
* @return com.epmet.dto.result.UserTokenResultDTO
* @author LiuJanJun
* @date 2021/2/24 1:28 下午
*/
UserTokenResultDTO thirdLoginOper(SsoLoginOperFormDTO formDTO);
}

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

@ -0,0 +1,546 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.thirdplat.apiservice.AbstractApiService;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import com.epmet.commons.thirdplat.constants.PyldConstants;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.*;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.enums.ThirdPlatformEnum;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.SsoRedis;
import com.epmet.service.SsoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @Author zxc
* @DateTime 2021/1/18 下午4:35
*/
@Service
@Slf4j
public class SsoServiceImpl implements SsoService {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private SsoRedis ssoRedis;
@Autowired
private JwtTokenUtils jwtTokenUtils;
@Autowired
private JwtTokenProperties jwtTokenProperties;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
/**
* @Description 0入口得到token
* @Param formDTO
* @author zxc
* @date 2021/1/18 下午4:59
*/
@Override
public SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO) {
String customerId = getCustomerId(formDTO.getAppId());
String userId = "";
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId));
if (!apiServiceResult.success()) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg());
}
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
}
ThirdPlatUserInfo userInfo;
try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
if (null == userInfo){
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空");
}
UserInfoFormDTO userInfoFormDTO = new UserInfoFormDTO();
userInfoFormDTO.setApp(formDTO.getApp());
userInfoFormDTO.setUid(userInfo.getOpenId());
userInfoFormDTO.setName(userInfo.getName());
userInfoFormDTO.setMobile(userInfo.getMobile());
Result<UserDTO> userDTOResult = epmetUserOpenFeignClient.saveUserInfo(userInfoFormDTO);
if (!userDTOResult.success()){
throw new RenException("【SSO登录】新增或更新user_weChat失败");
}
userId = userDTOResult.getData().getId();
if (StringUtils.isBlank(userId)){
throw new RenException("【SSO登录】userId为空,生成token失败");
}
//生成业务token
String token = this.generateToken(formDTO.getApp(), formDTO.getClient(), userId);
//存放Redis
if (StringUtils.isBlank(customerId)) {
throw new RenException("【SSO登录】customerId为空,缓存放置token失败");
}
this.disposeTokenDto(formDTO.getApp(), formDTO.getClient(), userId, token, customerId);
return new SsoLoginResultDTO(token);
}
@Override
public UserTokenResultDTO thirdLoginOper(SsoLoginOperFormDTO formDTO) {
ThirdPlatUserInfo thirdUser;
try {
ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform());
String apiService = platformEnum.getApiService();
AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService);
thirdUser = apiServiceImpl.getUserInfoByTicket(formDTO.getThirdToken());
} catch (RenException e) {
throw new RenException(e.getCode(), e.getMessage());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
if (thirdUser == null) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), PyldConstants.REPONSE_USER_NOT_LOGIN);
}
//获取用户信息
GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO();
form.setCustomerId(thirdUser.getCustomerId());
form.setMobile(thirdUser.getMobile());
Result<GovWebOperLoginResultDTO> result = epmetUserFeignClient.getStaffIdAndPwd(form);
//todo userId 写死测试 3f7f852ce22c511aa67ecb695395295d start
GovWebOperLoginResultDTO demo = new GovWebOperLoginResultDTO();
demo.setUserId("3f7f852ce22c511aa67ecb695395295d");
result = new Result<>();
result.ok(demo);
//test end
if (!result.success() || null == result.getData() || null == result.getData().getUserId()) {
logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在");
throw new RenException(EpmetErrorCode.ERR10003.getCode());
}
//4、生成token返回,且将TokenDto存到redis
//生成业务token
GovWebOperLoginResultDTO epmetUser = result.getData();
String token = this.generateToken(formDTO.getApp(), formDTO.getClient(), epmetUser.getUserId());
//存放Redis
this.disposeTokenDto(formDTO.getApp(), formDTO.getClient(), epmetUser.getUserId(), token, thirdUser.getCustomerId());
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
userTokenResultDTO.setCustomerId(thirdUser.getCustomerId());
return userTokenResultDTO;
}
/**
* @Description token放缓存
* @Param formDTO
* @Param userId
* @Param token
* @Param customerId
* @author zxc
* @date 2021/1/18 下午5:32
*/
public void disposeTokenDto(String app, String client, String userId, String token, String customerId) {
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
tokenDto.setCustomerId(customerId);
tokenDto.setApp(app);
tokenDto.setClient(client);
tokenDto.setUserId(userId);
tokenDto.setToken(token);
tokenDto.setUpdateTime(System.currentTimeMillis());
tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
ssoRedis.set(tokenDto, expire);
log.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
}
/**
* @Description 居民端登陆生成业务token的key
* @Param app
* @Param client
* @Param userId
* @author zxc
* @date 2021/1/18 下午5:14
*/
private String generateToken(String app, String client, String userId) {
Map<String, Object> map = new HashMap<>(16);
map.put("app", app);
map.put("client", client);
map.put("userId", userId);
String token = jwtTokenUtils.createToken(map);
log.info("app:" + app + ";client:" + client + ";userId:" + userId + ";生成token[" + token + "]");
return token;
}
/**
* @Description 获取customerId
* @Param appId
* @author zxc
* @date 2021/1/19 下午1:47
*/
public String getCustomerId(String appId){
JSONObject jsonObject = new JSONObject();
String customerMsgUrl = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/";
String data = HttpClientManager.getInstance().sendPostByJSON(customerMsgUrl + appId, JSON.toJSONString(jsonObject)).getData();
log.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data);
JSONObject toResult = JSON.parseObject(data);
Result mapToResult = ConvertUtils.mapToEntity(toResult, Result.class);
if (null != toResult.get("code")) {
mapToResult.setCode(((Integer) toResult.get("code")).intValue());
}
if (!mapToResult.success()) {
log.error(String.format("根据appId查询客户信息失败,对应appId->" + appId));
throw new RenException(mapToResult.getMsg());
}
Object publicCustomerResultDTO = mapToResult.getData();
JSONObject json = JSON.parseObject(publicCustomerResultDTO.toString());
Map<String, Object> map = (Map) json.get("customer");
PaCustomerDTO customer = ConvertUtils.mapToEntity(map, PaCustomerDTO.class);
log.info("小程序登陆third服务获取客户用户信息PaCustomerDTO->" + customer);
return customer.getId();
}
/**
* @param formDTO
* @Author sun
* @Description 1ticket自动登录获取内部token
**/
@Override
public UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO) {
//1.根据appId查询客户id
String customerId = getCustomerId(formDTO.getAppId());
//2.客户Id换取第三方apiService,根据ticket换取华为Id
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId));
if (!apiServiceResult.success()) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg());
}
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
}
ThirdPlatUserInfo userInfo;
try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
if (null == userInfo){
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空");
}
//3.根据华为openId查询用户是否存在历史登陆信息
Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserOpenFeignClient.getLatestStaffWechatLoginRecord(userInfo.getOpenId());
if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) {
logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg()));
throw new RenException(EpmetErrorCode.PLEASE_LOGIN.getCode());
}
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData();
//4.记录staff_wechat
this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), userInfo.getOpenId());
//5.记录登录日志
this.saveStaffLoginRecord(staffLatestAgencyResultDTO);
//6.获取用户token
String token = this.generateGovWxmpToken(staffLatestAgencyResultDTO.getStaffId(), formDTO.getApp(), formDTO.getClient());
//7.保存到redis
this.saveLatestGovTokenDto(staffLatestAgencyResultDTO, userInfo, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
/**
* @param userId openid
* @Author sun
* @Description 保存微信和当前登录用户关系
**/
private Result savestaffwechat(String userId, String openid) {
StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO();
staffWechatFormDTO.setUserId(userId);
staffWechatFormDTO.setWxOpenId(openid);
return epmetUserOpenFeignClient.saveStaffWechat(staffWechatFormDTO);
}
/**
* @param latestStaffWechatLoginDTO
* @Author sun
* @Description 保存登录日志
**/
private Result saveStaffLoginRecord(StaffLatestAgencyResultDTO latestStaffWechatLoginDTO) {
StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO();
staffLoginAgencyRecordFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId());
staffLoginAgencyRecordFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId());
staffLoginAgencyRecordFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId());
staffLoginAgencyRecordFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile());
staffLoginAgencyRecordFormDTO.setAgencyId(latestStaffWechatLoginDTO.getAgencyId());
Result staffLoginRecordResult = epmetUserOpenFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO);
return staffLoginRecordResult;
}
/**
* @Description 生成政府端小程序业务token Key
* @Author sun
**/
private String generateGovWxmpToken(String staffId, String app, String client) {
Map<String, Object> map = new HashMap<>();
map.put("app", app);
map.put("client", client);
map.put("userId", staffId);
String token = jwtTokenUtils.createToken(map);
logger.info("app:" + app + ";client:" + client + ";userId:" + staffId + ";生成token[" + token + "]");
return token;
}
/**
* @Description 保存tokenDto到redis
* @Author sun
**/
private void saveLatestGovTokenDto(StaffLatestAgencyResultDTO staffLatestAgency, ThirdPlatUserInfo userInfo, String token) {
int expire = jwtTokenProperties.getExpire();
GovTokenDto govTokenDto = new GovTokenDto();
govTokenDto.setApp(LoginConstant.APP_GOV);
govTokenDto.setClient(LoginConstant.CLIENT_WXMP);
govTokenDto.setUserId(staffLatestAgency.getStaffId());
govTokenDto.setOpenId(userInfo.getOpenId());
govTokenDto.setSessionKey("");
govTokenDto.setUnionId("");
govTokenDto.setToken(token);
govTokenDto.setUpdateTime(System.currentTimeMillis());
govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
govTokenDto.setRootAgencyId(staffLatestAgency.getAgencyId());
govTokenDto.setCustomerId(staffLatestAgency.getCustomerId());
//设置部门,网格,角色列表
govTokenDto.setDeptIdList(getDeptartmentIdList(staffLatestAgency.getStaffId()));
govTokenDto.setGridIdList(getGridIdList(staffLatestAgency.getStaffId()));
CustomerAgencyDTO agency = getAgencyByStaffId(staffLatestAgency.getStaffId());
if (agency != null) {
govTokenDto.setAgencyId(agency.getId());
govTokenDto.setRoleList(queryGovStaffRoles(staffLatestAgency.getStaffId(), agency.getId()));
}
govTokenDto.setOrgIdPath(getOrgIdPath(staffLatestAgency.getStaffId()));
cpUserDetailRedis.set(govTokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
}
public Set<String> getDeptartmentIdList(String staffId) {
try {
Result<List<DepartmentListResultDTO>> deptListResult = govOrgOpenFeignClient.getDepartmentListByStaffId(staffId);
if (deptListResult.success()) {
if (!CollectionUtils.isEmpty(deptListResult.getData())) {
Set<String> deptIdLists = deptListResult.getData().stream().map(dept -> dept.getDepartmentId()).collect(Collectors.toSet());
return deptIdLists;
}
} else {
logger.error("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg());
}
} catch (Exception e) {
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e);
logger.error("登录:查询部门列表异常:{}", errorStackTrace);
}
return null;
}
/**
* 根据工作人员ID查询网格ID列表
* @param staffId
*/
public Set<String> getGridIdList(String staffId) {
Result<List<GridByStaffResultDTO>> result = govOrgOpenFeignClient.listGridsbystaffid(staffId);
if (!result.success()) {
logger.error("登录:查询网格列表,远程调用返回错误:{}", result.getMsg());
return null;
} else {
List<GridByStaffResultDTO> grids = result.getData();
return grids.stream().map(grid -> grid.getGridId()).collect(Collectors.toSet());
}
}
/**
* 根据staffId查询所属的组织机构
*
* @param staffId
*/
public CustomerAgencyDTO getAgencyByStaffId(String staffId) {
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(staffId);
if (!result.success()) {
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
return null;
}
return result.getData();
}
/**
* 查询人员在某机关单位下的角色列表
* @param staffId orgId
*/
public List<GovTokenDto.Role> queryGovStaffRoles(String staffId, String orgId) {
StaffRoleFormDTO formDTO = new StaffRoleFormDTO();
formDTO.setStaffId(staffId);
formDTO.setOrgId(orgId);
Result<List<GovStaffRoleDTO>> gridResult = epmetUserOpenFeignClient.getRolesOfStaff(formDTO);
if (!CollectionUtils.isEmpty(gridResult.getData())) {
//return gridResult.getData().stream().map(role -> role.getId()).collect(Collectors.toSet());
return ConvertUtils.sourceToTarget(gridResult.getData(), GovTokenDto.Role.class);
}
return null;
}
/**
* 查询工作人员的OrgIdPath
* @param staffId
*/
public String getOrgIdPath(String staffId) {
Result<CustomerAgencyDTO> result = govOrgOpenFeignClient.getAgencyByStaff(staffId);
if (!result.success()) {
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
return null;
}
CustomerAgencyDTO agency = result.getData();
if (agency != null) {
if ("0".equals(agency.getPid())) {
// 顶级
return agency.getId();
} else {
return agency.getPids().concat(":").concat(agency.getId());
}
}
return null;
}
/**
* @param formDTO
* @Author sun
* @Description 4自动进入组织-返回token
**/
@Override
public UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO) {
//1、需要校验要登录的客户,是否被禁用
CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO();
customerStaffFormDTO.setCustomerId(formDTO.getCustomerId());
customerStaffFormDTO.setMobile(formDTO.getMobile());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfo(customerStaffFormDTO);
if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) {
logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
throw new RenException(customerStaffDTOResult.getCode());
}
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
//2.客户Id换取第三方apiService,根据ticket换取华为Id
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(formDTO.getCustomerId()));
if (!apiServiceResult.success()) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg());
}
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
}
ThirdPlatUserInfo userInfo;
try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
if (null == userInfo){
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空");
}
//3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), userInfo.getOpenId());
//4、记录登录日志
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = new StaffLatestAgencyResultDTO();
staffLatestAgencyResultDTO.setCustomerId(formDTO.getCustomerId());
staffLatestAgencyResultDTO.setStaffId(customerStaff.getUserId());
staffLatestAgencyResultDTO.setWxOpenId(userInfo.getOpenId());
staffLatestAgencyResultDTO.setMobile(formDTO.getMobile());
staffLatestAgencyResultDTO.setAgencyId(formDTO.getRootAgencyId());
this.saveStaffLoginRecord(staffLatestAgencyResultDTO);
//5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId(), formDTO.getApp(), formDTO.getClient());
//5.2、保存到redis
StaffLatestAgencyResultDTO staffLatestAgency = new StaffLatestAgencyResultDTO();
staffLatestAgency.setAgencyId(formDTO.getRootAgencyId());
staffLatestAgency.setCustomerId(formDTO.getCustomerId());
staffLatestAgency.setStaffId(customerStaff.getUserId());
this.saveLatestGovTokenDto(staffLatestAgency, userInfo, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
public static void main(String[] args) {
String url = "https://epmet-ext9.elinkservice.cn/platform/unifiedAuth/loginCheck";
String platformToken = "1348803062424166401_dd08e23b0d524879a5c67e7f2ffd1468";
String appId = "7a5aec009ba4eba8e254ee64fe3775e1";
String appKey = "14faef9af508d1c253b720ea5a43f9de";
String appSecret = "38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595";
long ts = System.currentTimeMillis();
String message = appId + appKey + appSecret + ts;
String accessToken = DigestUtils.md5Hex(message.getBytes(StandardCharsets.UTF_8));
//ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum("pyld");
JSONObject jsonObject = new JSONObject();
jsonObject.put("platformToken", platformToken);
Map<String, Object> headerMap = new HashMap<>(4);
headerMap.put("AppKey", appKey);
headerMap.put("Timestamp", ts);
headerMap.put("AccessToken", accessToken);
Result<String> stringResult = HttpClientManager.getInstance().sendPost(url, url.startsWith("https://"), jsonObject.toJSONString(), headerMap);
System.out.println(stringResult);
}
}

14
epmet-auth/src/main/resources/bootstrap.yml

@ -131,4 +131,16 @@ dingTalk:
shutdown:
graceful:
enable: true #是否开启优雅停机
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
# 调用第三方平台相关参数
thirdplat:
jcet:
domain: @thirdplat.jcet.domain@
appkey: @thirdplat.jcet.appkey@
appsecret: @thirdplat.jcet.appsecret@
pyld:
domain: https://epmet-ext9.elinkservice.cn/platform
appId: 7a5aec009ba4eba8e254ee64fe3775e1
appKey: 14faef9af508d1c253b720ea5a43f9de
appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595

5
epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java

@ -40,4 +40,9 @@ public interface LoginConstant {
* E事通服务号
*/
String CLIENT_MP = "mp";
/**
* 手机App
*/
String CLIENT_APP = "app";
}

22
epmet-commons/epmet-commons-thirdplat/pom.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>epmet-commons</artifactId>
<groupId>com.epmet</groupId>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>epmet-commons-thirdplat</artifactId>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>

36
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java

@ -0,0 +1,36 @@
package com.epmet.commons.thirdplat;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.thirdplat.dto.form.jcet.SsoTicketFormDTO;
import com.epmet.commons.thirdplat.dto.form.jcet.SsoTokenFormDTO;
import com.epmet.commons.thirdplat.encrypt.SignUtils;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
public class DemoApp {
private static String appid = "soXDEoM1";
private static String appsecret = "V7ea0KnlYt7eSyzc";
public static void main(String[] args) throws UnsupportedEncodingException {
//SsoToken ssoToken = new SsoToken();
//ssoToken.setSsoToken("wxz");
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket("wxz");
int bodyLength = JSON.toJSONString(ssoTicket).getBytes("utf-8").length;
Map<String, Object> headers = new HashMap();
long timestamp = System.currentTimeMillis();
headers.put("openTimestamp", String.valueOf(timestamp));
headers.put("openAppId", appid);
String encryptContent = appid + timestamp + bodyLength;
headers.put("openSign", SignUtils.generate(encryptContent, appsecret));
System.out.println(headers);
}
}

44
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java

@ -0,0 +1,44 @@
package com.epmet.commons.thirdplat.apiservice;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import com.epmet.commons.thirdplat.dto.result.jcet.JcetResult;
import com.epmet.commons.thirdplat.properties.ThirdplatProps;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
public abstract class AbstractApiService {
protected ThirdplatProps thirdplatProps;
/**
* 通过ticket查询用户信息
* @param ticket
* @return
* @throws Exception
*/
public abstract ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws Exception;
/**
* @Description 解析请求结果
* @return
* @author wxz
* @date 2021.01.19 09:53
*/
protected <R> R parseResult(Result<String> thResult, Class<R> resultType) {
if (!thResult.success()) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(thResult.getInternalMsg()));
}
JcetResult jcetResult = JSON.parseObject(thResult.getData(), JcetResult.class);
if (!jcetResult.isSuccess()) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
jcetResult.getMsg().concat(",错误码:") + jcetResult.getCode());
}
JSONObject jo = (JSONObject) jcetResult.getData();
return jo.toJavaObject(resultType);
}
}

117
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java

@ -0,0 +1,117 @@
package com.epmet.commons.thirdplat.apiservice.jcet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.thirdplat.apiservice.AbstractApiService;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import com.epmet.commons.thirdplat.constants.JcetConstants;
import com.epmet.commons.thirdplat.dto.form.jcet.SsoTicketFormDTO;
import com.epmet.commons.thirdplat.dto.result.jcet.JcetUserInfoResultDTO;
import com.epmet.commons.thirdplat.encrypt.SignUtils;
import com.epmet.commons.thirdplat.properties.JcetThirdplatProps;
import com.epmet.commons.thirdplat.properties.ThirdplatProps;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@Service
public class JcetApiService extends AbstractApiService {
Logger logger = LoggerFactory.getLogger(getClass());
private JcetThirdplatProps jcetThirdplatProps;
public JcetApiService(ThirdplatProps props) {
this.thirdplatProps = props;
jcetThirdplatProps = props.getJcet();
}
/**
* @return
* @Description 通过第三方平台ticket获取用户信息
* @author wxz
* @date 2021.01.19 10:26
*/
@Override
public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket);
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket(ticket);
String domain = jcetThirdplatProps.getDomain();
Result<String> result = HttpClientManager.getInstance().sendPost(
domain.concat(JcetConstants.URL_GET_USER_BY_TICKET),
domain.startsWith("https://"),
JSON.toJSONString(ssoTicket),
getHeaders(ssoTicket));
try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
} catch (Exception e) {
//e.printStackTrace();
}
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();
userInfo.setOpenId(resultDTO.getId());
userInfo.setName(resultDTO.getName());
userInfo.setMobile(resultDTO.getMobile());
return userInfo;
}
/**
* @return
* @Description 通过token获取用户信息
* @author wxz
* @date 2021.01.19 10:28
*/
//public JcetUserInfoResultDTO getUserInfoByToken(String token) throws UnsupportedEncodingException {
// SsoTokenFormDTO ssoToken = new SsoTokenFormDTO();
// ssoToken.setSsoToken(token);
//
// HashMap<String, Object> paramMap = new HashMap<>();
// paramMap.put(JcetConstants.PLAT_TOKEN_NAME, token);
//
// String domain = jcetThirdplatProps.getDomain();
//
// Result<String> result = HttpClientManager.getInstance().sendGet(
// domain.concat(JcetConstants.URL_GET_USER_BY_TOKEN),
// domain.startsWith("https://"),
// paramMap,
// getHeaders(ssoToken));
//
// JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class);
// return resultDTO;
//}
/**
* 获取请求所需要的头信息
*
* @param contentObject
* @return
* @throws UnsupportedEncodingException
*/
private Map<String, Object> getHeaders(Object contentObject) throws UnsupportedEncodingException {
int bodyLength = JSON.toJSONString(contentObject).getBytes(StandardCharsets.UTF_8).length;
Map<String, Object> headers = new HashMap();
long timestamp = System.currentTimeMillis();
headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, String.valueOf(timestamp));
headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, jcetThirdplatProps.getAppkey());
String encryptContent = jcetThirdplatProps.getAppkey() + timestamp + bodyLength;
headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, jcetThirdplatProps.getAppsecret()));
return headers;
}
}

122
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java

@ -0,0 +1,122 @@
package com.epmet.commons.thirdplat.apiservice.pyld;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.epmet.commons.thirdplat.apiservice.AbstractApiService;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import com.epmet.commons.thirdplat.constants.PyldConstants;
import com.epmet.commons.thirdplat.dto.result.jcet.PyldUserInfoResultDTO;
import com.epmet.commons.thirdplat.properties.PyldThirdplatProps;
import com.epmet.commons.thirdplat.properties.ThirdplatProps;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@Service
public class PyldApiService extends AbstractApiService {
Logger logger = LoggerFactory.getLogger(getClass());
private PyldThirdplatProps pyldThirdplatProps;
public PyldApiService(ThirdplatProps props) {
this.thirdplatProps = props;
pyldThirdplatProps = props.getPyld();
}
/**
* @return
* @Description 通过第三方平台ticket获取用户信息
* @author wxz
* @date 2021.01.19 10:26
*/
@Override
public ThirdPlatUserInfo getUserInfoByTicket(String platformToken) {
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken);
JSONObject jsonParam = new JSONObject();
jsonParam.put(PyldConstants.PLAT_PARAM_TOKEN, platformToken);
jsonParam.put(PyldConstants.PLAT_PARAM_MANAGEMENTKEY, PyldConstants.PLAT_PARAM_MANAGEMENTKEY_VALUE);
String domain = pyldThirdplatProps.getDomain();
Result<String> result = HttpClientManager.getInstance().sendPost(
domain.concat(PyldConstants.METHOD_CHECK_LOGIN),
domain.startsWith("https://"),
jsonParam.toJSONString(),
buildHeaders());
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
PyldUserInfoResultDTO resultDTO = this.parseResult(result);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();
userInfo.setMobile(resultDTO.getMobile());
userInfo.setCustomerId(resultDTO.getReserved());
return userInfo;
}
/**
* 构建请求头信息
*
* @return
*/
private Map<String, Object> buildHeaders() {
Map<String, Object> headers = new HashMap();
long timestamp = System.currentTimeMillis();
headers.put(PyldConstants.PLAT_HEADER_TIMESTAMP, timestamp);
headers.put(PyldConstants.PLAT_HEADER_APP_KEY, pyldThirdplatProps.getAppkey());
String encryptContent = pyldThirdplatProps.getAppId() + pyldThirdplatProps.getAppkey() + pyldThirdplatProps.getAppSecret() + timestamp;
headers.put(PyldConstants.PLAT_HEADER_ACCESS_TOKEN, DigestUtils.md5Hex(encryptContent.getBytes(StandardCharsets.UTF_8)));
return headers;
}
/**
* desc: 解析结果
*
* @param thResult
* @return com.epmet.commons.thirdplat.dto.result.jcet.JcetUserInfoResultDTO
* @author LiuJanJun
* @date 2021/2/24 10:11 上午
*/
private PyldUserInfoResultDTO parseResult(Result<String> thResult) {
if (!thResult.success()) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(thResult.getInternalMsg()));
}
JSONObject jcetResult = JSON.parseObject(thResult.getData());
Integer code = jcetResult.getInteger("code");
String msg = jcetResult.getString("msg");
if (code == null || code != 0) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), msg.concat(",错误码:") + code);
}
JSONObject data = jcetResult.getJSONObject("data");
if (data == null) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(PyldConstants.REPONSE_USER_NOT_LOGIN));
}
PyldUserInfoResultDTO userInfo = data.getObject("userInfo", PyldUserInfoResultDTO.class);
if (userInfo == null || StringUtils.isBlank(userInfo.getMobile()) || StringUtils.isBlank(userInfo.getReserved())) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), PyldConstants.REPONSE_USER_NOT_LOGIN);
}
return userInfo;
}
}

11
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/bean/ThirdPlatUserInfo.java

@ -0,0 +1,11 @@
package com.epmet.commons.thirdplat.bean;
import lombok.Data;
@Data
public class ThirdPlatUserInfo {
private String openId;
private String name;
private String mobile;
private String customerId;
}

28
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/config/ThirdplatConfig.java

@ -0,0 +1,28 @@
package com.epmet.commons.thirdplat.config;
import com.epmet.commons.thirdplat.apiservice.jcet.JcetApiService;
import com.epmet.commons.thirdplat.constants.ApiServiceBeansConstants;
import com.epmet.commons.thirdplat.properties.ThirdplatProps;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 第三方平台的相关配置
*/
@Configuration
@EnableConfigurationProperties(ThirdplatProps.class)
public class ThirdplatConfig {
/**
* @Description 酒城e通的apiService这个name需要注册进数据库使用的时候去数据库根据客户id找对应的apiService出来用
* @return
* @author wxz
* @date 2021.01.20 13:50
*/
@Bean(name = ApiServiceBeansConstants.JCET_API_SERVICE)
public JcetApiService JcetApiService(ThirdplatProps props) {
return new JcetApiService(props);
}
}

9
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/ApiServiceBeansConstants.java

@ -0,0 +1,9 @@
package com.epmet.commons.thirdplat.constants;
/**
* ApiService常量
*/
public interface ApiServiceBeansConstants {
// 酒城e通apiService
String JCET_API_SERVICE = "jcetApiService";
}

14
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/JcetConstants.java

@ -0,0 +1,14 @@
package com.epmet.commons.thirdplat.constants;
public interface JcetConstants {
String URL_GET_USER_BY_TICKET = "/openapi-cgw/openapi-login/sso/getUserInfoByTicket";
String URL_GET_USER_BY_TOKEN = "/openapi-cgw/openapi-login/sso/getUserInfoByToken";
String PLAT_TICKET_NAME = "ssoTicket";
String PLAT_TOKEN_NAME = "ssoToken";
String PLAT_HEADER_OPEN_TIMESTAMP = "openTimestamp";
String PLAT_HEADER_OPEN_APP_ID = "openAppId";
String PLAT_HEADER_OPEN_SIGN = "openSign";
}

18
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/PyldConstants.java

@ -0,0 +1,18 @@
package com.epmet.commons.thirdplat.constants;
public interface PyldConstants {
String METHOD_CHECK_LOGIN = "/unifiedAuth/loginCheck";
String PLAT_HEADER_TIMESTAMP = "timestamp";
String PLAT_HEADER_APP_KEY = "appkey";
String PLAT_HEADER_ACCESS_TOKEN = "accessToken";
String PLAT_PARAM_TOKEN = "platformToken";
String PLAT_PARAM_MANAGEMENTKEY = "managementKey";
String PLAT_PARAM_MANAGEMENTKEY_VALUE = "epmet_work";
String REPONSE_USER_NOT_LOGIN = "token失效,请重新登陆";
}

8
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/form/jcet/SsoTicketFormDTO.java

@ -0,0 +1,8 @@
package com.epmet.commons.thirdplat.dto.form.jcet;
import lombok.Data;
@Data
public class SsoTicketFormDTO {
private String ssoTicket;
}

8
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/form/jcet/SsoTokenFormDTO.java

@ -0,0 +1,8 @@
package com.epmet.commons.thirdplat.dto.form.jcet;
import lombok.Data;
@Data
public class SsoTokenFormDTO {
private String ssoToken;
}

13
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetResult.java

@ -0,0 +1,13 @@
package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data;
@Data
public class JcetResult {
private boolean success;
private String msg;
private Object data;
private int code;
}

29
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java

@ -0,0 +1,29 @@
package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data;
@Data
public class JcetUserInfoResultDTO {
private String id;
/**
* 用户名称
*/
private String userName;
/**
* 手机号码
*/
private String mobile;
/**
* 姓名
*/
private String name;
/**
* 邮箱
*/
private String email;
/**
* sessionId,用于维持在线状态
*/
private String oaSessionId;
}

18
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/PyldUserInfoResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data;
import java.io.Serializable;
@Data
public class PyldUserInfoResultDTO implements Serializable {
private static final long serialVersionUID = 6176427074670949388L;
/**
* 手机号
*/
private String mobile;
/**
* 客户Id
*/
private String reserved;
}

51
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/encrypt/EncryptUtils.java

@ -0,0 +1,51 @@
package com.epmet.commons.thirdplat.encrypt;
import com.epmet.commons.tools.exception.RenException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class EncryptUtils {
private final static char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
/**
* 32位 MD5加密
*
* @param s
* @return
*/
public static String md5Hex(String s) throws UnsupportedEncodingException {
byte[] result = digest("MD5", s.getBytes(Charset.defaultCharset()));
return hex(result);
}
/**
* 32 sha256加密
*
* @param s
* @return
*/
public static String sha256(String s) {
byte[] result = digest("SHA-256", s.getBytes(Charset.defaultCharset()));
return hex(result);
}
private static byte[] digest(String algorithm, byte[] data) {
try {
MessageDigest digest = MessageDigest.getInstance(algorithm);
digest.update(data, 0, data.length);
return digest.digest();
} catch (NoSuchAlgorithmException e) {
throw new RenException(algorithm + " error", e);
}
}
private static String hex(byte[] data) {
char[] result = new char[data.length * 2];
int c = 0;
for (byte b : data) {
result[c++] = HEX_DIGITS[(b >> 4) & 0xf];
result[c++] = HEX_DIGITS[b & 0xf];
}
return new String(result);
}
}

15
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/encrypt/SignUtils.java

@ -0,0 +1,15 @@
package com.epmet.commons.thirdplat.encrypt;
import java.io.UnsupportedEncodingException;
public class SignUtils {
public static String generate(String content, String secret) throws UnsupportedEncodingException {
String sign = EncryptUtils.sha256(content);
sign = EncryptUtils.md5Hex(sign + secret);
return sign;
}
public static void main(String[] args) {
System.out.println(777);
}
}

13
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/JcetThirdplatProps.java

@ -0,0 +1,13 @@
package com.epmet.commons.thirdplat.properties;
import lombok.Data;
/**
* 酒城e通三方平台配置
*/
@Data
public class JcetThirdplatProps {
private String domain;
private String appkey;
private String appsecret;
}

14
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/PyldThirdplatProps.java

@ -0,0 +1,14 @@
package com.epmet.commons.thirdplat.properties;
import lombok.Data;
/**
* 酒城e通三方平台配置
*/
@Data
public class PyldThirdplatProps {
private String domain;
private String appId;
private String appkey;
private String appSecret;
}

18
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java

@ -0,0 +1,18 @@
package com.epmet.commons.thirdplat.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
@Data
@ConfigurationProperties(prefix = "thirdplat")
public class ThirdplatProps {
/**
* 泸州 酒城e通
*/
private JcetThirdplatProps jcet;
/**
* 平阴联动指挥平台
*/
private PyldThirdplatProps pyld;
}

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java

@ -119,6 +119,11 @@ public interface ServiceConstant {
*/
String DATA_STATISTICAL_SERVER = "data-statistical-server";
/**
* 数据统计结果查询
*/
String DATA_REPORT_SERVER="data-report-server";
/**
* 微信第三方平台
*/

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

@ -33,7 +33,7 @@ public enum EnvEnum {
public static EnvEnum getEnum(String code) {
EnvEnum[] values = EnvEnum.values();
for (EnvEnum value : values) {
if (code != null && value.getCode().equals(code)) {
if (value.getCode().equals(code)) {
return value;
}
}

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

@ -72,6 +72,7 @@ public enum EpmetErrorCode {
NOT_DEL_AGENCY_GRID(8207, "该机关存在网格,不允许删除"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),
THIRD_PLAT_REQUEST_ERROR(8302, "请求第三方平台错误"),
NOT_ADD_GRID(8401,"您当前的网格名称已存在,请重新修改"),
MOBILE_USED(8402,"该手机号已注册"),
@ -145,7 +146,6 @@ public enum EpmetErrorCode {
TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"),
TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题");
private int code;
private String msg;

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

@ -361,4 +361,14 @@ public class RedisKeys {
public static String getResiUserKey(String userId){
return rootPrefix.concat("resi:user:").concat(userId);
}
/**
* @Description 客户的ApiService
* @return
* @author wxz
* @date 2021.01.20 16:56
*/
public static String getCustomerApiServiceKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId);
}
}

35
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoScanParamDTO.java

@ -0,0 +1,35 @@
package com.epmet.commons.tools.scan.param;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* 异步检测请求参数
*
* @author yinzuomei@elink-cn.com
* @date 2021/1/10 21:05
*/
@Data
public class VideoScanParamDTO implements Serializable {
private static final long serialVersionUID = -7261993744367287072L;
/**
* 是否开启回调
*/
@NotNull(message = "openCallBack必填,true开启;false不开启")
private Boolean openCallBack;
/**
* 异步检测结果回调地址,执行异步审查内容时 必填
* openCallBack=true时,callback必填
*/
private String callback;
@Valid
@NotEmpty(message = "任务列表不能为空")
private List<VideoTaskDTO> tasks;
}

32
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/VideoTaskDTO.java

@ -0,0 +1,32 @@
package com.epmet.commons.tools.scan.param;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 异步检测请求参数
*
* @author yinzuomei@elink-cn.com
* @date 2021/1/10 21:06
*/
@Data
public class VideoTaskDTO implements Serializable {
private static final long serialVersionUID = -5268462578193403270L;
/**
* 不必填
* 要检测的数据id 非必填
* 检测对象对应的数据ID
* 由大小写英文字母数字下划线_短划线-英文句号.组成不超过128个字符可以用于唯一标识您的业务数据
* */
@NotBlank(message = "dataId不能为空")
private String dataId;
/**
* 必填
* 待检测视频的URL该字段不能和frames同时为空也不能和frames同时有值
*/
@NotBlank(message = "音频URL不能为空")
private String url;
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/AsyncScanResult.java

@ -8,7 +8,7 @@ import java.util.List;
/**
* 语音异步检测 返参
*
* 视频异步检测 返参通用
* @author yinzuomei@elink-cn.com
* @date 2020/12/18 10:09
*/

47
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoAsyncScanResultDTO.java

@ -0,0 +1,47 @@
package com.epmet.commons.tools.scan.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 视频异步检测结果查询接口返参
* 正在检测中的不返回,调用方继续轮询查询结果
* @author yinzuomei@elink-cn.com
* @date 2020/12/29 15:37
*/
@Data
public class VideoAsyncScanResultDTO implements Serializable {
private static final long serialVersionUID = -7302168989456734818L;
/**
* 执行成功的任务Id集合
* code=200,且所有语音+视频所有场景返回结果都为pass时则为成功
*/
private List<String> passDataIds = new ArrayList<>();
/**
* 执行失败的任务Id集合
*/
private List<String> noPassDataIds = new ArrayList<>();
private List<String> passTaskIds = new ArrayList<>();
private List<String> noPassTaskIds = new ArrayList<>();
/**
* desc:阿里内容审核API返回结果详情
*/
private List<VideoScanDetailDTO> details = new ArrayList<>();
/**
* 本地是否全部通过
*/
private Boolean isAllPass;
public boolean isAllPass() {
if (noPassTaskIds.isEmpty() && !passTaskIds.isEmpty()) {
return true;
}
return isAllPass;
}
}

56
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/VideoScanDetailDTO.java

@ -0,0 +1,56 @@
package com.epmet.commons.tools.scan.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
*
* @author yinzuomei@elink-cn.com
* @date 2021/1/10 21:24
*/
@Data
public class VideoScanDetailDTO implements Serializable {
/**
* 错误码和HTTP状态码一致
* 更多信息请参见公共错误码
*/
private Integer code;
private String codeDesc;
/**
* 错误描述信息
*/
private String msg;
/**
* 检测对象对应的数据ID
*/
private String dataId;
/**
* 检测任务的ID
*/
private String taskId;
/**
* 返回结果调用成功时code=200返回结果中包含一个或多个元素每个元素是个结构体具体结构描述请参见result
* 说明 视频流检测场景中code返回280表示在检测中返回200表示检测完成在检测中状态时检测结果中包含从开始检测到当前时间的检测到结果
*/
private List<ResultDetail> results;
/**
* 视频语音检测结果具体结构描述请参见audioScanResult
*/
private List<ResultDetail> audioScanResults;
@Data
public static class ResultDetail {
private String scene;
private String label;
private String suggestion;
private Float rate;
}
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java

@ -24,6 +24,8 @@ public class BaseTokenDto {
*/
private String token;
private String customerId;
public BaseTokenDto() {
}

26
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyNode.java

@ -0,0 +1,26 @@
package com.epmet.commons.tools.utils;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/4 20:49
*/
@Data
public class AgencyNode<T> implements Serializable {
private String areaCode;
private String parentAreaCode;
/**
* 子节点列表
*/
private List<T> subAgencyList = new ArrayList<>();
}

73
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyTreeUtils.java

@ -0,0 +1,73 @@
package com.epmet.commons.tools.utils;
import com.epmet.commons.tools.validator.AssertUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/4 20:49
*/
public class AgencyTreeUtils {
/**
* 根据pid构建树节点
*/
public static <T extends AgencyNode> List<T> build(List<T> agencyNodes, String parentAreaCode) {
//pid不能为空
AssertUtils.isNull(parentAreaCode, "parentAreaCode");
List<T> treeList = new ArrayList<>();
for (T agencyNode : agencyNodes) {
if (parentAreaCode.equals(agencyNode.getParentAreaCode())) {
treeList.add(findChildren(agencyNodes, agencyNode));
}
}
return treeList;
}
/**
* 查找子节点
*/
private static <T extends AgencyNode> T findChildren(List<T> agencyNodes, T rootNode) {
for (T agencyNode : agencyNodes) {
if (rootNode.getAreaCode().equals(agencyNode.getParentAreaCode())) {
rootNode.getSubAgencyList().add(findChildren(agencyNodes, agencyNode));
}
}
return rootNode;
}
/**
* 构建树节点
*/
public static <T extends AgencyNode> List<T> build(List<T> agencyNodes) {
List<T> result = new ArrayList<>();
//list转map
Map<String, T> nodeMap = new LinkedHashMap<>(agencyNodes.size());
for (T agencyNode : agencyNodes) {
nodeMap.put(agencyNode.getAreaCode(), agencyNode);
}
for (T node : nodeMap.values()) {
T parent = nodeMap.get(node.getParentAreaCode());
if (parent != null && !(node.getAreaCode().equals(parent.getAreaCode()))) {
parent.getSubAgencyList().add(node);
continue;
}
result.add(node);
}
return result;
}
}

34
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -729,4 +729,38 @@ public class DateUtils {
LocalDate ldn = new LocalDate(date);
return ldn.dayOfMonth().withMaximumValue().toDate();
}
/**
* @return ["202002","202003","202004","202005","202006","202007","202008","202009","202010","202011","202012","202101"]
* @param monthId 202101
* @param num 11
* @description 截止到当前monthId,近12个月的坐标
* @Date 2021/2/1 17:20
**/
public static List<String> getMonthIdList(String monthId,int num) {
List<String> monthIdList = new ArrayList<>();
for (int i = num; i >= NumConstant.ZERO; i--) {
Calendar c = Calendar.getInstance();
c.setTime(com.epmet.commons.tools.utils.DateUtils.stringToDate(monthId.concat("01"), com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN_YYYYMMDD));
c.add(Calendar.MONTH, -i);
Date date = c.getTime();
String month = com.epmet.commons.tools.utils.DateUtils.format(date, com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN_YYYYMM);
// monthIdList.add(month.substring(4, 6).concat("月"));
monthIdList.add(month);
}
return monthIdList;
}
/**
* @author yinzuomei
* @description 获取当前时间的山个月monthId
* @Date 2021/2/1 17:41
**/
public static String getCurrentTimeBeforeMonthId(){
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.add(Calendar.MONTH, -1);
Date nowDate = c.getTime();
return com.epmet.commons.tools.utils.DateUtils.format(nowDate, com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN_YYYYMM);
}
}

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

@ -188,6 +188,30 @@ public class HttpClientManager {
}
public Result<String> sendPost(String url, boolean isHttps, String jsonStrParam, Map<String, Object> headerMap) {
try {
HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig);
httppost.addHeader(HEADER_CONTENT_TYPE, HEADER_APPLICATION_JSON);
if (null != headerMap) {
headerMap.forEach((k, v) -> {
if (v != null)
httppost.addHeader(k, v.toString());
});
}
if (StringUtils.isNotEmpty(jsonStrParam)) {
StringEntity se = new StringEntity(jsonStrParam, UTF8);
httppost.setEntity(se);
}
return execute(httppost, isHttps);
} catch (Exception e) {
log.error("send exception", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
/**
* 上传临时素材
* @author zhaoqifeng
@ -325,6 +349,31 @@ public class HttpClientManager {
}
}
public Result<String> sendGet(String url, boolean isHttps, Map<String, Object> params, Map<String,String> headerMap) {
try {
URIBuilder builder = new URIBuilder(url);
if (!CollectionUtils.isEmpty(params)) {
Set<String> set = params.keySet();
for (String key : set) {
builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key)));
}
}
HttpGet httpGet = new HttpGet(builder.build());
httpGet.setConfig(requestConfig);
if (null != headerMap){
headerMap.forEach((k,v) -> {
httpGet.addHeader(k,v);
});
}
return execute(httpGet, isHttps);
} catch (Exception e) {
log.error("sendGet exception", e);
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
private Result<String> execute(HttpRequestBase httpMethod, boolean isHttps) {
CloseableHttpResponse response = null;
try {

88
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java

@ -8,6 +8,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.param.*;
import com.epmet.commons.tools.scan.result.AsyncScanResult;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.scan.result.VideoAsyncScanResultDTO;
import com.epmet.commons.tools.scan.result.VoiceResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -136,6 +137,65 @@ public class ScanContentUtils {
}
}
/**
* @param url 视频地址
* @param param
* @author yinzuomei
* @description 异步检测-提交检测任务
**/
public static Result<AsyncScanResult> videoAsyncScan(String url, VideoScanParamDTO param){
log.debug("videoAsyncScan param:{}", JSON.toJSONString(param));
if (StringUtils.isBlank(url) || param == null) {
throw new RenException("参数错误");
}
if (param.getOpenCallBack() && StringUtils.isBlank(param.getCallback())) {
throw new RenException("参数错误,开启回调,callback必填");
}
try {
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param));
log.debug("videoAsyncScan result:{}", JSON.toJSONString(result));
if (result.success()) {
return JSON.parseObject(result.getData(),new TypeReference<Result<AsyncScanResult>>(){});
}
Result<AsyncScanResult> resultResult = new Result<>();
resultResult.error(result.getCode(),result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.error("videoAsyncScan exception:", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
}
}
/**
* @param url
* @param taskIds
* @author yinzuomei
* @description 查询视频检测结果
**/
public static Result<VideoAsyncScanResultDTO> videoResults(String url, List<String> taskIds) {
if (StringUtils.isBlank(url) || CollectionUtils.isEmpty(taskIds)) {
throw new RenException("参数错误");
}
if (taskIds.size() > NumConstant.ONE_HUNDRED) {
throw new RenException("参数错误,查询检测任务最大不能超过100");
}
try {
Result<String> result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(taskIds));
log.debug("videoResults result:{}", JSON.toJSONString(result));
if (result.success()) {
return JSON.parseObject(result.getData(), new TypeReference<Result<VideoAsyncScanResultDTO>>() {
});
}
Result<VideoAsyncScanResultDTO> resultResult = new Result<>();
resultResult.error(result.getCode(), result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.error("voiceResults exception:", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
}
}
public static void main(String[] args) {
//测试文本检测
@ -143,7 +203,11 @@ public class ScanContentUtils {
//测试语音检测
// testVoiceAsyncScan();
//语音检测结果
testVoiceResults();
// testVoiceResults();
//视频检测任务提交
// testVideoAsyncScan();
//查询视频检测结果
testVideoResults();
}
public static void testTextSyncScan(){
@ -200,4 +264,26 @@ public class ScanContentUtils {
Result<List<VoiceResultDTO>> asyncScanResultResult = ScanContentUtils.voiceResults(url, taskIds);
System.out.println("================" + JSON.toJSONString(asyncScanResultResult));
}
public static void testVideoAsyncScan(){
String url = "http://localhost:8107/epmetscan/api/videoAsyncScan";
VideoTaskDTO p = new VideoTaskDTO();
p.setDataId("1");
p.setUrl("https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20210111/e996a68b9f0144a3843666c430f73086.mp4");
List<VideoTaskDTO> list = new ArrayList<>();
list.add(p);
VideoScanParamDTO param = new VideoScanParamDTO();
param.setTasks(list);
param.setOpenCallBack(false);
Result<AsyncScanResult> asyncScanResultResult = ScanContentUtils.videoAsyncScan(url, param);
System.out.println(JSON.toJSONString(asyncScanResultResult));
}
public static void testVideoResults(){
String url = "http://localhost:8107/epmetscan/api/videoResults";
List<String> taskIds=new ArrayList<>();
taskIds.add("vi6ZatqnJEkqf5m@FZ7Ka0AU-1tKYdk");
Result<VideoAsyncScanResultDTO> result = ScanContentUtils.videoResults(url, taskIds);
System.out.println("================" + JSON.toJSONString(result));
}
}

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

@ -7,7 +7,6 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.mq.EventClassDto;
import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO;
import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.enums.MqMethodPathEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ValidateException;
@ -29,85 +28,91 @@ import java.util.Map;
@Slf4j
@Component
public class SendMqMsgUtils {
private static MqConfig mqConfig;
private static MqConfig mqConfig;
/**
* desc:发送mq消息
*
* @return
*/
public static Result<String> sendMsg(MqBaseMsgDTO msg) {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
log.debug("sendMsg param:{}", JSON.toJSONString(msg));
try {
// TODO
ValidatorUtils.validateEntity(msg, DefaultGroup.class);
} catch (ValidateException e) {
return new Result<String>().error(e.getMsg());
}
msg.setAppId(mqConfig.getAppId());
msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode()));
msg.setToken(mqConfig.getToken());
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg));
log.debug("sendMsg result:{}", JSON.toJSONString(result));
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
JSONObject jsonObject = JSON.parseObject(resultResult.getData());
return new Result<String>().ok(jsonObject.getString("msgId"));
} else {
log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult));
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg());
}
}
Result<String> resultResult = new Result<>();
resultResult.error(result.getCode(), result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.debug("sendMsg exception", e);
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
/**
* desc:发送mq消息(如果失败重试1次)
*
* @return
*/
public static Result<String> sendMsg(MqBaseMsgDTO msg) {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
log.info("sendMsg param:{}", JSON.toJSONString(msg));
try {
// TODO
ValidatorUtils.validateEntity(msg, DefaultGroup.class);
} catch (ValidateException e) {
return new Result<String>().error(e.getMsg());
}
msg.setAppId(mqConfig.getAppId());
msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode()));
msg.setToken(mqConfig.getToken());
try {
int retryTime = 0;
Result<String> result = null;
do {
retryTime++;
result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg));
log.info("sendMsg retryTime:{},result:{}", retryTime, JSON.toJSONString(result));
} while ((!result.success()) && retryTime < 2);
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
JSONObject jsonObject = JSON.parseObject(resultResult.getData());
return new Result<String>().ok(jsonObject.getString("msgId"));
} else {
log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult));
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg());
}
}
Result<String> resultResult = new Result<>();
resultResult.error(result.getCode(), result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.error("sendMsg exception", e);
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
/**
* desc:发送mq消息
*
* @return
*/
public static Result<List<EventClassDto>> getEventClassList() {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
Map<String, String> param = new HashMap<>();
param.put("appId", mqConfig.getAppId());
param.put("token", mqConfig.getToken());
String requestUrl = mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode());
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(param));
log.debug("getEventClassList result:{}", JSON.toJSONString(result));
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
List<EventClassDto> eventClassDto = JSON.parseArray(resultResult.getData(), EventClassDto.class);
return new Result<List<EventClassDto>>().ok(eventClassDto);
} else {
log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult));
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg());
}
}
Result<List<EventClassDto>> resultResult = new Result<>();
resultResult.error(result.getCode(), result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.debug("sendMsg exception", e);
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
/**
* desc:发送mq消息
*
* @return
*/
public static Result<List<EventClassDto>> getEventClassList() {
if (mqConfig == null) {
mqConfig = SpringContextUtils.getBean(MqConfig.class);
}
Map<String, String> param = new HashMap<>();
param.put("appId", mqConfig.getAppId());
param.put("token", mqConfig.getToken());
String requestUrl = mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode());
try {
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(param));
log.info("getEventClassList result:{}", JSON.toJSONString(result));
if (result.success()) {
MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class);
if (resultResult.getErrCode().equals(NumConstant.ZERO)) {
List<EventClassDto> eventClassDto = JSON.parseArray(resultResult.getData(), EventClassDto.class);
return new Result<List<EventClassDto>>().ok(eventClassDto);
} else {
log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult));
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg());
}
}
Result<List<EventClassDto>> resultResult = new Result<>();
resultResult.error(result.getCode(), result.getMsg());
resultResult.setInternalMsg(result.getInternalMsg());
return resultResult;
} catch (Exception e) {
log.error("sendMsg exception", e);
return new Result<List<EventClassDto>>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
}

1
epmet-commons/pom.xml

@ -23,6 +23,7 @@
<module>epmet-commons-tools-wx-mp</module>
<module>epmet-commons-service-call</module>
<module>epmet-commons-extapp-auth</module>
<module>epmet-commons-thirdplat</module>
<module>epmet-commons-rocketmq</module>
</modules>

16
epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java

@ -105,13 +105,17 @@ public class InternalAuthProcessor extends AuthProcessor {
if (baseTokenDto != null) {
String redisKey = baseTokenDto.getApp() + "-" + baseTokenDto.getClient() + "-" + baseTokenDto.getUserId();
logger.info("redisKey=" + redisKey);
exchange.getRequest().mutate()
.header(Constant.APP_USER_KEY, redisKey)
.header(AppClientConstant.APP,baseTokenDto.getApp())
.header(AppClientConstant.CLIENT,baseTokenDto.getClient())
.header(AppClientConstant.USER_ID,baseTokenDto.getUserId());
if (StringUtils.equals(baseTokenDto.getApp(), "gov")) {//工作端
ServerHttpRequest.Builder builder = exchange.getRequest().mutate();
builder.header(Constant.APP_USER_KEY, redisKey);
builder.header(AppClientConstant.APP,baseTokenDto.getApp());
builder.header(AppClientConstant.CLIENT,baseTokenDto.getClient());
builder.header(AppClientConstant.USER_ID,baseTokenDto.getUserId());
if (StringUtils.isNotBlank(baseTokenDto.getCustomerId())) {
builder.header(AppClientConstant.CUSTOMER_ID,baseTokenDto.getCustomerId());
}
if (StringUtils.equalsAny(baseTokenDto.getApp(), AppClientConstant.APP_GOV, AppClientConstant.APP_RESI)) {//工作端/居民端
if(StringUtils.isNotBlank(customerId)){
exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
}

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

@ -468,7 +468,7 @@ epmet:
- /epmet/ext/**
- /epmetuser/customerstaff/customerlist
- /message/template/**
- /data/aggregator/project/projectdistribution
swaggerUrls:
jwt:

16
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govissue/result/IssueInfoDTO.java

@ -0,0 +1,16 @@
package com.epmet.dataaggre.dto.govissue.result;
import lombok.Data;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/24 12:12
*/
@Data
public class IssueInfoDTO {
private String issueId;
private String gridId;
private String topicId;
}

4
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerAgencyDTO.java

@ -128,4 +128,8 @@ public class CustomerAgencyDTO implements Serializable {
*/
private String district;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
}

19
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dataaggre.dto.govproject.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 项目分布实时只适用于e事通客户入参
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/24 11:04
*/
@Data
public class ProjectDistributionFormDTO implements Serializable {
private String gridId;
@NotBlank(message = "customerId不能为空")
private String customerId;
}

25
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/result/ProjectDistributionResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dataaggre.dto.govproject.result;
import lombok.Data;
import java.io.Serializable;
/**
* 项目分布实时只适用于e事通客户返参
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/24 11:05
*/
@Data
public class ProjectDistributionResultDTO implements Serializable {
private String projectId;
private String projectTitle;
private String statusDesc;
private String longitude;
private String latitude;
// @JsonIgnore
private String issueId;
// @JsonIgnore
private String statusCode;
private String gridId;
}

7
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicDTO.java

@ -17,9 +17,10 @@
package com.epmet.dataaggre.dto.resigroup;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -128,4 +129,8 @@ public class ResiTopicDTO implements Serializable {
*/
private String issueId;
/**
* 话题所属网格id
*/
private String gridId;
}

25
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovProjectController.java

@ -5,14 +5,16 @@ import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectDistributionFormDTO;
import com.epmet.dataaggre.dto.govproject.result.AllProjectResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.service.govproject.GovProjectService;
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 org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author zxc
@ -39,4 +41,19 @@ public class GovProjectController {
AllProjectResultDTO result = govProjectService.allProjectList(tokenDto, formDTO);
return new Result<AllProjectResultDTO>().ok(result);
}
/**
* @param customerId
* @param formDTO
* @author yinzuomei 项目分布实时只适用于e事通客户返参
* @description 目前在用龙湾大屏调用此接口接口内写死了 按照立项时间降序取前100个项目
* @Date 2021/2/24 13:17
**/
@PostMapping("projectdistribution")
public Result<List<ProjectDistributionResultDTO>> queryProjectDistribution(@RequestHeader("CustomerId") String customerId,
@RequestBody ProjectDistributionFormDTO formDTO){
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
return new Result<List<ProjectDistributionResultDTO>>().ok(govProjectService.queryProjectDistribution(formDTO));
}
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govissue/IssueDao.java

@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govissue.form.ClosedIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.ShiftProjectIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.VotingIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.result.ClosedIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueShiftProjectResultDTO;
import com.epmet.dataaggre.dto.govissue.result.VotingIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.*;
import com.epmet.dataaggre.entity.govissue.IssueEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -75,4 +72,6 @@ public interface IssueDao extends BaseDao<IssueEntity> {
List<ClosedIssueListResultDTO> selectClosedListGov(ClosedIssueListFormDTO fromDTO);
Integer selectIssueCount(@Param("gridIds") List<String> gridIds,@Param("issueType")String issueType);
List<IssueInfoDTO> selectShiftProjectIssueList(@Param("customerId") String customerId, @Param("gridId") String gridId);
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govproject/ProjectDao.java

@ -18,18 +18,17 @@
package com.epmet.dataaggre.dao.govproject;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectInfoDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govproject.ProjectDTO;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectInfoDTO;
import com.epmet.dataaggre.entity.govproject.ProjectEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.List;
/**
* 项目表
*
@ -68,4 +67,5 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
**/
List<String> selectDepartmentNameList(ProjectDTO project);
List<ProjectDistributionResultDTO> selectList(@Param("customerId") String customerId,@Param("list")List<String> issueIds);
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiTopicDao.java

@ -18,8 +18,12 @@
package com.epmet.dataaggre.dao.resigroup;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.entity.resigroup.ResiTopicEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 话题信息表
@ -29,5 +33,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ResiTopicDao extends BaseDao<ResiTopicEntity> {
List<ResiTopicDTO> selectTopicInfoByIds(@Param("list") List<String> topicIds);
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java

@ -94,4 +94,8 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
*/
private String district;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java

@ -5,10 +5,7 @@ import com.epmet.dataaggre.dto.govissue.form.AllIssueFormDTO;
import com.epmet.dataaggre.dto.govissue.form.ClosedIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.ShiftProjectIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.form.VotingIssueListFormDTO;
import com.epmet.dataaggre.dto.govissue.result.AllIssueResultDTO;
import com.epmet.dataaggre.dto.govissue.result.ClosedIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.ShiftProjectIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.VotingIssueListResultDTO;
import com.epmet.dataaggre.dto.govissue.result.*;
import java.util.List;
@ -46,4 +43,6 @@ public interface GovIssueService {
* @author sun
**/
List<ClosedIssueListResultDTO> closedIssueList(ClosedIssueListFormDTO fromDTO);
List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId);
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java

@ -313,4 +313,9 @@ public class GovIssueServiceImpl implements GovIssueService {
return resultList;
}
@Override
public List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId) {
return issueDao.selectShiftProjectIssueList(customerId,gridId);
}
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/GovProjectService.java

@ -1,12 +1,11 @@
package com.epmet.dataaggre.service.govproject;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectDistributionFormDTO;
import com.epmet.dataaggre.dto.govproject.result.AllProjectResultDTO;
import java.util.List;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ShiftProjectResultDTO;
import java.util.List;
@ -41,4 +40,5 @@ public interface GovProjectService {
List<ShiftProjectResultDTO> getProjectByIssue(List<String> issueIdList);
List<ProjectDistributionResultDTO> queryProjectDistribution(ProjectDistributionFormDTO formDTO);
}

39
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java

@ -8,17 +8,21 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.ProjectConstant;
import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao;
import com.epmet.dataaggre.dao.govproject.ProjectDao;
import com.epmet.dataaggre.dto.govissue.result.IssueInfoDTO;
import com.epmet.dataaggre.dto.govissue.result.IssueListResultDTO;
import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO;
import com.epmet.dataaggre.dto.govproject.ProjectDTO;
import com.epmet.dataaggre.dto.govproject.form.AllProjectFormDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectDistributionFormDTO;
import com.epmet.dataaggre.dto.govproject.result.AllProjectResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectInfoDTO;
import com.epmet.dataaggre.dto.govproject.result.ShiftProjectResultDTO;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.service.govissue.GovIssueService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import com.epmet.dataaggre.service.govproject.GovProjectService;
import com.epmet.dataaggre.service.resigroup.ResiGroupService;
import com.epmet.dto.form.TimestampIntervalFormDTO;
import com.epmet.dto.form.WorkMinuteFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
@ -46,6 +50,10 @@ public class GovProjectServiceImpl implements GovProjectService {
private GovOrgService govOrgService;
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Autowired
private GovIssueService govIssueService;
@Autowired
private ResiGroupService resiGroupService;
/**
* @Description 查询项目信息
@ -103,6 +111,33 @@ public class GovProjectServiceImpl implements GovProjectService {
return resultList;
}
@Override
public List<ProjectDistributionResultDTO> queryProjectDistribution(ProjectDistributionFormDTO formDTO) {
List<ProjectDistributionResultDTO> resultDTOList = new ArrayList<>();
List<IssueInfoDTO> issueInfoDTOList = govIssueService.selectShiftProjectIssueList(formDTO.getCustomerId(), formDTO.getGridId());
if (CollectionUtils.isNotEmpty(issueInfoDTOList)) {
List<String> topicIds = issueInfoDTOList.stream().map(data -> data.getTopicId()).collect(Collectors.toList());
// log.info("话题id集合:" + JSON.toJSONString(topicIds, true));
List<ResiTopicDTO> topicInfoDTOList = resiGroupService.selectTopicInfoByIds(topicIds);
List<String> issueIds = issueInfoDTOList.stream().map(data -> data.getIssueId()).collect(Collectors.toList());
// log.info("议题id集合:" + JSON.toJSONString(issueIds, true));
resultDTOList = projectDao.selectList(formDTO.getCustomerId(),issueIds);
for (ProjectDistributionResultDTO project : resultDTOList) {
for (ResiTopicDTO topicInfoDTO : topicInfoDTOList) {
if (project.getIssueId().equals(topicInfoDTO.getIssueId())) {
//维度
project.setLatitude(topicInfoDTO.getDimension());
//经度
project.setLongitude(topicInfoDTO.getLongitude());
project.setGridId(topicInfoDTO.getGridId());
break;
}
}
}
}
return resultDTOList;
}
/**
* 全部项目

6
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java

@ -1,8 +1,14 @@
package com.epmet.dataaggre.service.resigroup;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:21
*/
public interface ResiGroupService {
List<ResiTopicDTO> selectTopicInfoByIds(@Param("topicIds") List<String> topicIds);
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java

@ -2,10 +2,15 @@ package com.epmet.dataaggre.service.resigroup.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.resigroup.ResiTopicDao;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.service.resigroup.ResiGroupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:21
@ -14,4 +19,11 @@ import org.springframework.stereotype.Service;
@DataSource(DataSourceConstant.RESI_GROUP)
@Slf4j
public class ResiGroupServiceImpl implements ResiGroupService {
@Autowired
private ResiTopicDao resiTopicDao;
@Override
public List<ResiTopicDTO> selectTopicInfoByIds(List<String> topicIds) {
return resiTopicDao.selectTopicInfoByIds(topicIds);
}
}

17
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml

@ -107,4 +107,21 @@
</foreach>)
</select>
<select id="selectShiftProjectIssueList" parameterType="map" resultType="com.epmet.dataaggre.dto.govissue.result.IssueInfoDTO">
SELECT
i.ID as issueId,
i.GRID_ID as gridId,
i.SOURCE_ID as topicId
FROM
issue i
WHERE
i.DEL_FLAG = '0'
AND i.ISSUE_STATUS = 'shift_project'
and i.SOURCE_TYPE='resi_topic'
AND i.CUSTOMER_ID = #{customerId}
<if test="gridId != null and gridId.trim() != ''">
AND i.GRID_ID = #{gridId}
</if>
order by i.SHIFTED_TIME desc limit 100
</select>
</mapper>

18
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml

@ -124,4 +124,22 @@
AND p.id = #{id}
</select>
<select id="selectList" parameterType="map" resultType="com.epmet.dataaggre.dto.govproject.result.ProjectDistributionResultDTO">
SELECT
p.id AS projectId,
p.TITLE AS projectTitle,
( CASE WHEN p.`STATUS` = 'pending' THEN '处理中' WHEN p.`STATUS` = 'closed' THEN '已结案' ELSE '' END ) AS statusDesc,
p.`STATUS` as statusCode,
p.ORIGIN_ID as issueId
FROM
project p
WHERE
p.DEL_FLAG = '0'
and p.CUSTOMER_ID=#{customerId}
and p.ORIGIN_ID in
<foreach item="issueId" collection="list" separator="," open="(" close=")" index="">
#{issueId}
</foreach>
order by CREATED_TIME desc limit 100
</select>
</mapper>

21
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiTopicDao.xml

@ -2,5 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.resigroup.ResiTopicDao">
<select id="selectTopicInfoByIds" parameterType="map" resultType="com.epmet.dataaggre.dto.resigroup.ResiTopicDTO">
SELECT
rt.id ,
rt.ISSUE_ID ,
rt.LONGITUDE,
rt.DIMENSION,
RG.GRID_ID
FROM
resi_topic rt
LEFT JOIN resi_group RG
ON(RT.GROUP_ID=RG.ID)
WHERE rt.DEL_FLAG='0'
AND rt.SHIFT_ISSUE = '1'
and LENGTH(rt.LONGITUDE)>0
AND LENGTH(RT.DIMENSION)>0
and rt.id in
<foreach item="topicId" collection="list" separator="," open="(" close=")" index="">
#{topicId}
</foreach>
</select>
</mapper>

142
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java

@ -0,0 +1,142 @@
/**
* 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;
import java.math.BigDecimal;
/**
* 项目(事件)分类按网格_按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-02-23
*/
@Data
public class ScreenProjectCategoryGridDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 日期yyyyMMdd
*/
private String dateId;
/**
* 网格id
*/
private String gridId;
/**
* 网格所属的组织id
*/
private String pid;
/**
* 网格所有的父级id,以英文:或者英文,隔开
*/
private String pids;
/**
* e世通中的项目类别编码
*/
private String epmetCategoryCode;
/**
* 该分类下所有项目总数
*/
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
*/
private BigDecimal unResolvedRatio;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

147
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java

@ -0,0 +1,147 @@
/**
* 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;
import java.math.BigDecimal;
/**
* 项目(事件)分类按组织_按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-02-23
*/
@Data
public class ScreenProjectCategoryOrgDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 日期yyyyMMdd
*/
private String dateId;
/**
* 组织id
*/
private String orgId;
/**
* 社区级community街道:street,区县级: district,市级: city省级:province
*/
private String orgType;
/**
* 当前orgId所属的上级id
*/
private String pid;
/**
* orgId所有的父级id,以英文:或者英文,隔开
*/
private String pids;
/**
* e世通中的项目类别编码
*/
private String epmetCategoryCode;
/**
* 该分类下所有项目总数
*/
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
*/
private BigDecimal unResolvedRatio;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

59
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectQuantityOrgMonthlyDTO.java

@ -0,0 +1,59 @@
/**
* 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 lombok.Data;
import java.io.Serializable;
/**
* 项目(事件)数量分析按组织_按月统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-01-27
*/
@Data
public class ScreenProjectQuantityOrgMonthlyDTO implements Serializable {
private static final long serialVersionUID = 6821188282305837207L;
/**
* 客户ID
*/
private String customerId;
/**
* 日期yyyyMMdd
*/
private String monthId;
/**
* 组织id
*/
private String orgId;
/**
* 当前组织内本月新增的项目数量转项目日期在当前月份内
*/
private Integer projectIncr;
/**
* 截止到当前月份累计项目总数
*/
private Integer projectTotal;
}

21
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/CategoryAnalysisFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.dto.form.screen;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/2/23 15:26
*/
@Data
public class CategoryAnalysisFormDTO implements Serializable {
private static final long serialVersionUID = -3088762710988337423L;
public interface CategoryAnalysis{}
@NotBlank(message = "组织ID不能为空",groups = {CategoryAnalysis.class})
private String agencyId;
}

20
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/EfficiencyAnalysisFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.form.screen;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 事件分析效率分析 入参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/1 18:27
*/
@Data
public class EfficiencyAnalysisFormDTO extends ScreenCommonFormDTO{
/**
* 网格grid 街道street
*/
@NotBlank(message = "type不能为空:网格:grid; 街道:street")
private String type;
}

28
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/QueryQuantityMonthlyFormDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.form.screen;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 近12个月事件分析月度数量分析 入参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/1 16:34
*/
@Data
public class QueryQuantityMonthlyFormDTO extends ScreenCommonFormDTO{
private static final long serialVersionUID = 8848067533647648347L;
/**
* 每月项目增量incr累计项目数量sum
*/
@NotBlank(message = "type不能为空:每月项目增量:incr;累计项目数量:sum")
private String type ;
/**
* 截止到某月格式yyyyMM可为空
*/
private String endMonthId;
}

24
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/ScreenCommonFormDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.form.screen;
import lombok.Data;
import java.io.Serializable;
/**
* 大屏通用入参
*
* @author yinzuomei@elink-cn.com
*/
@Data
public class ScreenCommonFormDTO implements Serializable {
private static final long serialVersionUID = -5959152175751211940L;
/**
* 来源于请求头中的customerId
*/
private String customerId;
/**
* 当前要查询的组织id
*/
private String agencyId;
}

49
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java

@ -0,0 +1,49 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 组织机构信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-21
*/
@Data
public class ScreenCustomerAgencyDTO implements Serializable {
private static final long serialVersionUID = 6328123559936824470L;
/**
* 客户id
*/
private String customerId;
/**
* 组织id
*/
private String agencyId;
/**
* 组织名称
*/
private String agencyName;
/**
* 机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province
*/
private String level;
/**
* 行政地区编码
*/
private String areaCode;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
}

18
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/commonservice/AddAreaCodeDictResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.result.commonservice;
import lombok.Data;
import java.io.Serializable;
/**
* 003新增街道或者社区地区编码 入参
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/5 17:39
*/
@Data
public class AddAreaCodeDictResultDTO implements Serializable {
private static final long serialVersionUID = 7505566589581480619L;
private String code;
}

50
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/AgencyNodeDTO.java

@ -0,0 +1,50 @@
package com.epmet.dto.result.plugins;
import com.epmet.commons.tools.utils.AgencyNode;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 008当前用户的数据权限(多客户版本) 返参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/3 20:33
*/
@Data
public class AgencyNodeDTO extends AgencyNode<AgencyNodeDTO> implements Serializable {
private static final long serialVersionUID = -3745920378557792529L;
/**
* 直属机关Id
* */
private String agencyId;
/**
* 直属机关名称
* */
private String agencyName;
/**
* 机关级别社区级community 街道:street, 区县级: district, 市级: city 省级:province
* */
private String level;
/**
* 当前agencyId所属的客户id add02.03
* */
private String customerId;
/**
* 直属机关直属网格列表
* */
private List<GridNodeDTO> gridList = new ArrayList<>();
/**
* 直属机关直属部门列表
* */
private List<DeptNodeDTO> departmentList = new ArrayList<>();
}

15
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/BidInfoResultDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.result.plugins;
import lombok.Data;
/**
* 146体系竞标管理-列表
*
* @author yinzuomei@elink-cn.com
* @date 2021/1/22 13:37
*/
@Data
public class BidInfoResultDTO {
private String bidName;
private String statusDesc;
}

19
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/ContractResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.result.plugins;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 146体系合同监督-列表
*
* @author yinzuomei@elink-cn.com
* @date 2021/1/22 13:30
*/
@Data
public class ContractResultDTO {
private String contractListName;
@JsonFormat(pattern = "yyyy.MM.dd", timezone = "GMT+8")
private Date dueDate;
}

36
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/DeptNodeDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result.plugins;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 部门信息
* @ClassName ExtDeptResultDTO
* @Auth wangc
* @Date 2020-08-17 17:16
*/
@Data
public class DeptNodeDTO implements Serializable {
private static final long serialVersionUID = 1792371558965832432L;
/**
* 部门Id
* */
private String deptId;
/**
* 部门名称
* */
private String deptName;
/**
* 当前deptId所属的customerId add02.03
* */
private String customerId;
/**
* 当前deptId对应的地区编码 add02.03
* */
private String areaCode;
}

36
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/GridNodeDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result.plugins;
import lombok.Data;
import java.io.Serializable;
/**
* 008当前用户的数据权限(多客户版本) 返参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/3 20:33
*/
@Data
public class GridNodeDTO implements Serializable {
private static final long serialVersionUID = -4531574240525562587L;
/**
* 网格Id
* */
private String gridId;
/**
* 网格名称
* */
private String gridName;
/**
* 当前gridId所属的客户id add02.03
* */
private String customerId;
/**
* 当前gridId对应的地区编码 add02.03
* */
private String areaCode;
}

18
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/OneListResultDTO.java

@ -0,0 +1,18 @@
package com.epmet.dto.result.plugins;
import lombok.Data;
import java.io.Serializable;
/**
* 146体系清单列表
*
* @author yinzuomei@elink-cn.com
* @date 2021/1/22 13:23
*/
@Data
public class OneListResultDTO implements Serializable {
private static final long serialVersionUID = -1578923862757670664L;
private String listName;
private String listId;
}

26
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result.screen;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/2/23 15:28
*/
@NoArgsConstructor
@Data
public class CategoryAnalysisResultDTO implements Serializable {
private static final long serialVersionUID = 4500337306142206855L;
/**
* 类别名称
*/
private String categoryName;
/**
* 项目总数
*/
private Integer projectTotal;
}

40
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/EfficiencyAnalysisResultDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.result.screen;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 事件分析效率分析 返参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/1 18:23
*/
@Data
public class EfficiencyAnalysisResultDTO implements Serializable {
private static final long serialVersionUID = 7291513498972998552L;
/**
* 可能是网格名也可能是组织名
*/
private String name;
/**
* 解决率: %:90.74%
*/
private String resolvedRatioStr;
/**
* 解决率数值 90.74
*/
private BigDecimal resolvedRatio;
/**
* 方便查找日志
*/
private String customerId;
private String agencyId;
private String gridId;
private String dateId;
}

40
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/ProjectQuantityResultDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.result.screen;
import lombok.Data;
/**
* 事件分析数量统计查询
*
* @author yinzuomei@elink-cn.com
* @date 2021/1/29 16:39
*/
@Data
public class ProjectQuantityResultDTO {
/**
* 事件总数
*/
private Integer projectTotal;
/**
* 已解决数
*/
private Integer resolvedNum;
/**
* 解决率,%号的字符串
*/
private String resolvedRatio;
/**
* 事件总数,%号的字符串
*/
private String satisfactionRatio;
/**
* 方便查找日志
*/
private String customerId;
private String agencyId;
private String dateId;
}

27
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/QueryQuantityMonthlyResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result.screen;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 近12个月事件分析月度数量分析 返参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/1 16:57
*/
@Data
public class QueryQuantityMonthlyResultDTO implements Serializable {
private static final long serialVersionUID = -9214182002720799008L;
/**
* 横坐标集合
*/
private List<String> xAxis;
/**
* 每个月的项目增量或者累计数量根据入参type决定
*/
private List<Integer> yAxis;
}

17
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/constant/ScreenConstant.java

@ -24,4 +24,21 @@ public interface ScreenConstant {
String GET_AREA_TREE_FAILURE = "查询行政地区编码树失败......";
String STREET = "street";
String DISTRICT = "district";
String CITY = "city";
String PROVINCE = "province";
String LEVEL = "level";
String STR_NULL = "";
String ENGLISH_COMMA = ",";
String GRID = "grid";
String AGENCY = "agency";
}

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

@ -3,6 +3,7 @@ package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -21,4 +22,6 @@ public class FineExampleFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {FineExample.class})
private String agencyId;
private String customerId;
}

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

@ -26,4 +26,9 @@ public class MonthBarchartFormDTO implements Serializable {
* 月份ID,如果此列有值查询截止到当前monthId的近12个月数据
*/
private String monthId;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

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

@ -21,4 +21,9 @@ public class MonthPieChartFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {MonthPieChart.class})
private String agencyId;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

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

@ -0,0 +1,19 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @description:
* @author: liushaowen
* @date: 2021/2/24 16:12
*/
@Data
public class ScreenProjectDetailFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank(message = "projectId不能为空")
private String projectId;
}

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

@ -0,0 +1,21 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @description:
* @author: liushaowen
* @date: 2021/2/24 15:22
*/
@Data
public class ScreenProjectDistributionFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String areaCode;
private String level;
private String agencyId;
}

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

@ -30,4 +30,9 @@ public class SubAgencyIndexRankFormDTO implements Serializable {
private Integer topNum;
private String yearId;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

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

@ -53,4 +53,9 @@ public class SubAgencyIndexRankYMFormDTO implements Serializable {
* 组织类型 组织agency 网格grid
*/
private String orgType;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

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

Loading…
Cancel
Save