Browse Source

Merge branches 'dev' and 'dev_add_customer_id' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_add_customer_id

 Conflicts:
	epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java
master
sunyuchao 5 years ago
parent
commit
b53b94cc49
  1. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDeptController.java
  2. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java
  3. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictTypeController.java
  4. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogErrorController.java
  5. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogLoginController.java
  6. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogOperationController.java
  7. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysMenuController.java
  8. 5
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysParamsController.java
  9. 10
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRegionController.java
  10. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRoleController.java
  11. 6
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysUserController.java
  12. 95
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/log/LogConsumer.java
  13. 5
      epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml
  14. 48
      epmet-auth/pom.xml
  15. 32
      epmet-auth/src/main/java/com/epmet/controller/GovWebController.java
  16. 25
      epmet-auth/src/main/java/com/epmet/controller/LoginController.java
  17. 11
      epmet-auth/src/main/java/com/epmet/controller/SsoController.java
  18. 6
      epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java
  19. 42
      epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java
  20. 5
      epmet-auth/src/main/java/com/epmet/service/SsoService.java
  21. 8
      epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java
  22. 36
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  23. 1
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  24. 34
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  25. 6
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  26. 23
      epmet-auth/src/main/resources/bootstrap.yml
  27. 2
      epmet-auth/src/main/resources/logback-spring.xml
  28. 2
      epmet-cloud-generator/src/main/resources/application.yml
  29. 4
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  30. 2
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java
  31. 10
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java
  32. 64
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java
  33. 7
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
  34. 2
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java
  35. 25
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java
  36. 11
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java
  37. 5
      epmet-commons/epmet-commons-tools/pom.xml
  38. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java
  39. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  40. 84
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java
  41. 109
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java
  42. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  43. 67
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java
  44. 121
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java
  45. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  46. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  47. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java
  48. 14
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  49. 153
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  50. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java
  51. 135
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
  52. 43
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java
  53. 65
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  54. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
  55. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java
  56. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  57. 100
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  58. 251
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java
  59. 9
      epmet-gateway/src/main/resources/bootstrap.yml
  60. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/GroupConstant.java
  61. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java
  62. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java
  63. 13
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java
  64. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java
  65. 35
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/form/CandidateListFormDTO.java
  66. 57
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/result/CandidateListResultDTO.java
  67. 29
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/ResiGroupController.java
  68. 22
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java
  69. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiGroupDao.java
  70. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java
  71. 47
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java
  72. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  73. 30
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  74. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java
  75. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java
  76. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java
  77. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java
  78. 58
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java
  79. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
  80. 34
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml
  81. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml
  82. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml
  83. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiGroupDao.xml
  84. 41
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java
  85. 41
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java
  86. 18
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDistributionFormDTO.java
  87. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java
  88. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java
  89. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordTrendResultDTO.java
  90. 43
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java
  91. 41
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java
  92. 6
      epmet-module/data-report/data-report-server/pom.xml
  93. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java
  94. 54
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java
  95. 49
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java
  96. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java
  97. 5
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  98. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectGridDailyDao.java
  99. 11
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java
  100. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDeptController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysDeptDTO;
import com.epmet.service.SysDeptService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -56,7 +55,6 @@ public class SysDeptController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Dept")
public Result save(@RequestBody SysDeptDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -68,7 +66,6 @@ public class SysDeptController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Dept")
public Result update(@RequestBody SysDeptDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -80,7 +77,6 @@ public class SysDeptController {
@DeleteMapping("{id}")
@ApiOperation("删除")
@LogOperation("Delete Dept")
public Result delete(@PathVariable("id") Long id){
//效验数据
AssertUtils.isNull(id, "id");

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.service.SysDictDataService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -67,7 +66,6 @@ public class SysDictDataController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody SysDictDataDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -79,7 +77,6 @@ public class SysDictDataController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody SysDictDataDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -91,7 +88,6 @@ public class SysDictDataController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictTypeController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysDictTypeDTO;
import com.epmet.service.SysDictTypeService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -69,7 +68,6 @@ public class SysDictTypeController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody SysDictTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -81,7 +79,6 @@ public class SysDictTypeController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody SysDictTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -93,7 +90,6 @@ public class SysDictTypeController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogErrorController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysLogErrorDTO;
import com.epmet.service.SysLogErrorService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -59,7 +58,6 @@ public class SysLogErrorController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Log Error")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysLogErrorDTO> list = sysLogErrorService.list(params);

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogLoginController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysLogLoginDTO;
import com.epmet.service.SysLogLoginService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -60,7 +59,6 @@ public class SysLogLoginController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Log Login")
@ApiImplicitParams({
@ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功 2:账号已锁定", paramType = "query", dataType="int"),
@ApiImplicitParam(name = "creatorName", value = "用户名", paramType = "query", dataType="String")

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogOperationController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysLogOperationDTO;
import com.epmet.service.SysLogOperationService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -63,7 +62,6 @@ public class SysLogOperationController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Log Operation")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysLogOperationDTO> list = sysLogOperationService.list(params);

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysMenuController.java

@ -12,7 +12,6 @@ import com.epmet.dto.MenuResourceDTO;
import com.epmet.dto.SysMenuDTO;
import com.epmet.service.SysMenuService;
import com.epmet.service.SysResourceService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.Result;
@ -83,7 +82,6 @@ public class SysMenuController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Menu")
public Result save(@RequestBody SysMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -95,7 +93,6 @@ public class SysMenuController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Menu")
public Result update(@RequestBody SysMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -107,7 +104,6 @@ public class SysMenuController {
@DeleteMapping("{id}")
@ApiOperation("删除")
@LogOperation("Delete Menu")
public Result delete(@PathVariable("id") Long id){
//效验数据
AssertUtils.isNull(id, "id");

5
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysParamsController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysParamsDTO;
import com.epmet.service.SysParamsService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -72,7 +71,6 @@ public class SysParamsController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Params")
public Result save(@RequestBody SysParamsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -84,7 +82,6 @@ public class SysParamsController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Params")
public Result update(@RequestBody SysParamsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -96,7 +93,6 @@ public class SysParamsController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("Delete Params")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -108,7 +104,6 @@ public class SysParamsController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Params")
@ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysParamsDTO> list = sysParamsService.list(params);

10
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRegionController.java

@ -11,7 +11,6 @@ package com.epmet.controller;
import com.epmet.dto.SysRegionDTO;
import com.epmet.dto.region.RegionProvince;
import com.epmet.service.SysRegionService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
@ -71,8 +70,7 @@ public class SysRegionController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody SysRegionDTO dto){
public Result save(@RequestBody SysRegionDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -83,8 +81,7 @@ public class SysRegionController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody SysRegionDTO dto){
public Result update(@RequestBody SysRegionDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -95,8 +92,7 @@ public class SysRegionController {
@DeleteMapping("{id}")
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@PathVariable("id") Long id){
public Result delete(@PathVariable("id") Long id){
//效验数据
AssertUtils.isNull(id, "id");

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRoleController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysRoleDTO;
import com.epmet.service.SysRoleService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -94,7 +93,6 @@ public class SysRoleController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Role")
public Result save(@RequestBody SysRoleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -106,7 +104,6 @@ public class SysRoleController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Role")
public Result update(@RequestBody SysRoleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -118,7 +115,6 @@ public class SysRoleController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("Delete Role")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

6
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysUserController.java

@ -13,7 +13,6 @@ import com.epmet.dto.PasswordDTO;
import com.epmet.dto.SysUserDTO;
import com.epmet.service.SysResourceService;
import com.epmet.service.SysUserService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.page.PageData;
@ -98,7 +97,6 @@ public class SysUserController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save User")
public Result save(@RequestBody SysUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -110,7 +108,6 @@ public class SysUserController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update User")
public Result update(@RequestBody SysUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -122,7 +119,6 @@ public class SysUserController {
@PutMapping("password")
@ApiOperation("修改密码")
@LogOperation("Password User")
public Result password(@RequestBody PasswordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto);
@ -141,7 +137,6 @@ public class SysUserController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("Delete User")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -153,7 +148,6 @@ public class SysUserController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export User")
@ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysUserDTO> list = sysUserService.list(params);

95
epmet-admin/epmet-admin-server/src/main/java/com/epmet/log/LogConsumer.java

@ -1,95 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.log;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.log.BaseLog;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.entity.SysLogErrorEntity;
import com.epmet.entity.SysLogLoginEntity;
import com.epmet.entity.SysLogOperationEntity;
import com.epmet.service.SysLogErrorService;
import com.epmet.service.SysLogLoginService;
import com.epmet.service.SysLogOperationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 从Redis队列中获取Log保存到DB
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Slf4j
@Component
public class LogConsumer implements CommandLineRunner {
@Autowired
private RedisUtils redisUtils;
@Autowired
private SysLogErrorService sysLogErrorService;
@Autowired
private SysLogLoginService sysLogLoginService;
@Autowired
private SysLogOperationService sysLogOperationService;
private ScheduledExecutorService scheduledService = new ScheduledThreadPoolExecutor(1,
new BasicThreadFactory.Builder().namingPattern("log-consumer-schedule-pool-%d").daemon(true).build());
@Override
public void run(String... args) {
//上次任务结束后,等待10秒钟,再执行下次任务
scheduledService.scheduleWithFixedDelay(() -> {
try {
receiveQueue();
}catch (Exception e){
log.error("LogConsumer Error:"+ ExceptionUtils.getErrorStackTrace(e));
}
}, 1, 10, TimeUnit.SECONDS);
}
private void receiveQueue() {
String key = RedisKeys.getSysLogKey();
//每次插入100条
int count = 100;
for(int i = 0; i < count; i++){
BaseLog log = (BaseLog) redisUtils.rightPop(key);
if(log == null){
return;
}
//登录日志
if(log.getType() == LogTypeEnum.LOGIN.value()){
SysLogLoginEntity entity = ConvertUtils.sourceToTarget(log, SysLogLoginEntity.class);
sysLogLoginService.save(entity);
}
//操作日志
if(log.getType() == LogTypeEnum.OPERATION.value()){
SysLogOperationEntity entity = ConvertUtils.sourceToTarget(log, SysLogOperationEntity.class);
sysLogOperationService.save(entity);
}
//异常日志
if(log.getType() == LogTypeEnum.ERROR.value()){
SysLogErrorEntity entity = ConvertUtils.sourceToTarget(log, SysLogErrorEntity.class);
sysLogErrorService.save(entity);
}
}
}
}

5
epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml

@ -1,5 +1,6 @@
server:
port: @server.port@
version: @version@
servlet:
context-path: /sys
@ -112,7 +113,7 @@ feign:
config:
default:
loggerLevel: BASIC
httpclient:
okhttp:
enabled: true
@ -132,4 +133,4 @@ ribbon:
shutdown:
graceful:
enable: true #是否开启优雅停机
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警

48
epmet-auth/pom.xml

@ -200,9 +200,15 @@
</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>
<thirdplat.jcet.c.domain>http://101.206.141.251:21006</thirdplat.jcet.c.domain>
<thirdplat.jcet.c.appkey>soXDEoM1</thirdplat.jcet.c.appkey>
<thirdplat.jcet.c.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.c.appsecret>
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
<profile>
@ -249,9 +255,15 @@
</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>
<thirdplat.jcet.c.domain>http://101.206.141.251:21006</thirdplat.jcet.c.domain>
<thirdplat.jcet.c.appkey>soXDEoM1</thirdplat.jcet.c.appkey>
<thirdplat.jcet.c.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.c.appsecret>
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
<profile>
@ -293,9 +305,15 @@
</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>
<thirdplat.jcet.c.domain>http://101.206.141.251:21006</thirdplat.jcet.c.domain>
<thirdplat.jcet.c.appkey>soXDEoM1</thirdplat.jcet.c.appkey>
<thirdplat.jcet.c.appsecret>V7ea0KnlYt7eSyzc</thirdplat.jcet.c.appsecret>
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
@ -341,9 +359,15 @@
</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>
<thirdplat.jcet.c.domain>https://jcytc.lzjczl.com:21009</thirdplat.jcet.c.domain>
<thirdplat.jcet.c.appkey>2cy0a9lA</thirdplat.jcet.c.appkey>
<thirdplat.jcet.c.appsecret>6hU3PQgxLcXr27SE</thirdplat.jcet.c.appsecret>
<thirdplat.jcet.g.domain>http://101.206.141.219:21006</thirdplat.jcet.g.domain>
<thirdplat.jcet.g.appkey>xSMONWwP</thirdplat.jcet.g.appkey>
<thirdplat.jcet.g.appsecret>UUCnxLyXiB4eBF4p</thirdplat.jcet.g.appsecret>
<epmet.third.urlprefix>https://epmet-cloud.elinkservice.cn</epmet.third.urlprefix>
</properties>
</profile>
</profiles>

32
epmet-auth/src/main/java/com/epmet/controller/GovWebController.java

@ -1,19 +1,22 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.RSASignature;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.GovWebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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;
/**
* @Description PC工作端-登陆服务
* @author sun
* @Description PC工作端-登陆服务
*/
@RestController
@RequestMapping("govweb")
@ -21,7 +24,10 @@ public class GovWebController {
@Autowired
private GovWebService govWebService;
@Value("${epmet.login.publicKey}")
private String publicKey;
@Value("${epmet.login.privateKey}")
private String privateKey;
/**
* @param formDTO
@ -32,8 +38,30 @@ public class GovWebController {
@PostMapping("login")
public Result<UserTokenResultDTO> workLogin(@RequestBody GovWebLoginFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
try {
if (formDTO.getPassword().length() > 50) {
String newPassword = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey);
formDTO.setPassword(newPassword);
}
} catch (Exception e) {
e.printStackTrace();
}
return new Result<UserTokenResultDTO>().ok(govWebService.login(formDTO));
}
/**
* desc: 获取前端密码加密 公钥
*
* @return com.epmet.commons.tools.utils.Result
* @author LiuJanJun
* @date 2021/3/8 5:07 下午
*/
@PostMapping("getKey")
public Result<String> getPubKey() {
return new Result().ok(publicKey);
}
}

25
epmet-auth/src/main/java/com/epmet/controller/LoginController.java

@ -12,6 +12,7 @@ import com.epmet.dto.form.ResiWxPhoneFormDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.CaptchaService;
import com.epmet.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,6 +29,7 @@ import java.io.IOException;
* @Author yinzuomei
* @Date 2020/3/14 13:58
*/
@Slf4j
@RestController
@RequestMapping("login")
public class LoginController {
@ -47,15 +49,20 @@ public class LoginController {
**/
@GetMapping("captcha")
public void captcha(HttpServletResponse response, String uuid) throws IOException {
//uuid不能为空
AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL);
//生成图片验证码
BufferedImage image = captchaService.create(uuid);
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
out.close();
try {
//uuid不能为空
AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL);
//生成图片验证码
BufferedImage image = captchaService.create(uuid);
response.reset();
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
out.close();
} catch (IOException e) {
log.error("获取登陆验证码异常", e);
}
}
/**

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

@ -6,6 +6,7 @@ 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.SsoWorkLoginFormDTO;
import com.epmet.dto.form.SsoLoginOperFormDTO;
import com.epmet.dto.result.SsoLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
@ -37,9 +38,9 @@ public class SsoController {
* @date 2021/1/18 下午4:59
*/
@PostMapping("resi/login")
public Result<SsoLoginResultDTO> ssoLogin(@RequestBody SsoLoginFormDTO formDTO) {
public Result<SsoLoginResultDTO> ssoResiLogin(@RequestBody SsoLoginFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoLogin(formDTO));
return new Result<SsoLoginResultDTO>().ok(ssoService.ssoResiLogin(formDTO));
}
/**
@ -58,7 +59,7 @@ public class SsoController {
public Result<ThirdPlatUserInfo> testssoLogin() {
ThirdPlatUserInfo userInfoByTicket = null;
try {
userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
userInfoByTicket = jcetApiService.getCUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
} catch (Exception e) {
e.printStackTrace();
}
@ -71,8 +72,8 @@ public class SsoController {
* @Description 1ticket自动登录获取内部token
**/
@PostMapping("work/login")
public Result<UserTokenResultDTO> ssoWorkLogin(@RequestBody SsoLoginFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class);
public Result<UserTokenResultDTO> ssoWorkLogin(@RequestBody SsoWorkLoginFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, SsoWorkLoginFormDTO.SsoLoginForm.class);
return new Result<UserTokenResultDTO>().ok(ssoService.ssoWorkLogin(formDTO));
}

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

@ -15,10 +15,10 @@ public class SsoEnteOrgFormDTO implements Serializable {
public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {}
/**
* wxCode
* sso票据有效期为300秒
*/
@NotBlank(message = "ticket不能为空",groups = {AddUserInternalGroup.class})
private String ticket;
@NotBlank(message = "ssotoken不能为空",groups = SsoWorkLoginFormDTO.SsoLoginForm.class)
private String token;
/**
* 手机号

42
epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.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 SsoWorkLoginFormDTO implements Serializable {
private static final long serialVersionUID = -6543952487970013031L;
public interface SsoLoginForm{}
/**
* sso票据有效期为300秒
*/
@NotBlank(message = "ssotoken不能为空",groups = SsoLoginForm.class)
private String token;
/**
* 三方平台应用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;
}

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

@ -3,6 +3,7 @@ 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.form.SsoWorkLoginFormDTO;
import com.epmet.dto.result.SsoLoginResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
@ -18,14 +19,14 @@ public interface SsoService {
* @author zxc
* @date 2021/1/18 下午4:59
*/
SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO);
SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO);
/**
* @param formDTO
* @Author sun
* @Description 1ticket自动登录获取内部token
**/
UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO);
UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO);
/**
* @param formDTO

8
epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java

@ -14,7 +14,6 @@ import com.epmet.commons.tools.log.SysLogLogin;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.log.enums.LoginOperationEnum;
import com.epmet.commons.tools.log.enums.LoginStatusEnum;
import com.epmet.commons.tools.log.producer.LogProducer;
import com.epmet.commons.tools.redis.UserDetailRedis;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.security.user.SecurityUser;
@ -49,8 +48,6 @@ public class AuthServiceImpl implements AuthService {
@Autowired
private UserDetailRedis userDetailRedis;
@Autowired
private LogProducer logProducer;
@Autowired
private JwtUtils jwtUtils;
@Autowired
private JwtProperties jwtProperties;
@ -76,7 +73,6 @@ public class AuthServiceImpl implements AuthService {
if(user == null){
log.setStatus(LoginStatusEnum.FAIL.value());
log.setCreatorName(login.getUsername());
logProducer.saveLog(log);
throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR);
}
@ -86,7 +82,6 @@ public class AuthServiceImpl implements AuthService {
log.setStatus(LoginStatusEnum.FAIL.value());
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
logProducer.saveLog(log);
throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR);
}
@ -96,7 +91,6 @@ public class AuthServiceImpl implements AuthService {
log.setStatus(LoginStatusEnum.LOCK.value());
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
logProducer.saveLog(log);
throw new RenException(ErrorCode.ACCOUNT_DISABLE);
}
@ -116,7 +110,6 @@ public class AuthServiceImpl implements AuthService {
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
log.setStatus(LoginStatusEnum.SUCCESS.value());
logProducer.saveLog(log);
return authorization;
}
@ -138,7 +131,6 @@ public class AuthServiceImpl implements AuthService {
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
log.setCreateDate(new Date());
logProducer.saveLog(log);
userDetailRedis.logout(userId);
}

36
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -79,13 +79,13 @@ public class GovLoginServiceImpl implements GovLoginService {
public void sendSmsCode(SendSmsCodeFormDTO formDTO) {
//1、校验手机号是否符合规范
if (!PhoneValidatorUtils.isMobile(formDTO.getMobile())) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg()));
logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg()));
throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode());
}
//2、根据手机号校验用户是否存在
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//3、发送短信验证码
@ -94,7 +94,7 @@ public class GovLoginServiceImpl implements GovLoginService {
sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM);
Result<SendVerificationCodeResultDTO> smsCodeResult=epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO);
if (!smsCodeResult.success()) {
logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg()));
logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg()));
throw new RenException(smsCodeResult.getCode());
}
//4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis)
@ -114,13 +114,13 @@ public class GovLoginServiceImpl implements GovLoginService {
//1、根据手机号查询到用户信息
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) {
logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
logger.warn(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//2、验证码是否正确
String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile());
if (!formDTO.getSmsCode().equals(rightSmsCode)) {
logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
logger.warn(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//3、查询用户所有的组织信息
@ -134,7 +134,7 @@ public class GovLoginServiceImpl implements GovLoginService {
if(result.success()&&null!=result.getData()){
return result.getData();
}
logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,验证码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER,formDTO.getMobile(),formDTO.getSmsCode(),result.getCode(),result.getMsg()));
logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,验证码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER,formDTO.getMobile(),formDTO.getSmsCode(),result.getCode(),result.getMsg()));
return new ArrayList<>();
}
@ -147,7 +147,7 @@ public class GovLoginServiceImpl implements GovLoginService {
}
Result<StaffLatestAgencyResultDTO> latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid());
if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) {
logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg()));
logger.warn(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();
@ -222,7 +222,7 @@ public class GovLoginServiceImpl implements GovLoginService {
public Set<String> getGridIdList(String staffId) {
Result<List<GridByStaffResultDTO>> result = govOrgFeignClient.listGridsbystaffid(staffId);
if (!result.success()) {
logger.error("登录:查询网格列表,远程调用返回错误:{}", result.getMsg());
logger.warn("登录:查询网格列表,远程调用返回错误:{}", result.getMsg());
return null;
} else {
List<GridByStaffResultDTO> grids = result.getData();
@ -239,11 +239,11 @@ public class GovLoginServiceImpl implements GovLoginService {
return deptIdLists;
}
} else {
logger.error("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg());
logger.warn("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg());
}
} catch (Exception e) {
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e);
logger.error("登录:查询部门列表异常:{}", errorStackTrace);
logger.warn("登录:查询部门列表异常:{}", errorStackTrace);
}
return null;
}
@ -268,7 +268,7 @@ public class GovLoginServiceImpl implements GovLoginService {
customerStaffFormDTO.setMobile(formDTO.getMobile());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserFeignClient.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()));
logger.warn(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();
@ -291,7 +291,7 @@ public class GovLoginServiceImpl implements GovLoginService {
@Override
public void loginOut(TokenDto tokenDto) {
if(null == tokenDto){
logger.error("token解析失败,直接跳转重新登录即可");
logger.warn("token解析失败,直接跳转重新登录即可");
throw new RenException("当前用户信息获取失败");
}
cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId());
@ -328,7 +328,7 @@ public class GovLoginServiceImpl implements GovLoginService {
//1、根据手机号查询到用户信息
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile());
if (!customerStaffResult.success()) {
logger.error(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
logger.warn(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//2、密码是否正确
@ -357,12 +357,12 @@ public class GovLoginServiceImpl implements GovLoginService {
}
//根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码
if(!havePasswordFlag){
logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile()));
logger.warn(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
//密码错误
if(!passwordRightFlag){
logger.error(String.format("根据当前手机号(%s)密码未找到所属组织,密码错误",formDTO.getMobile()));
logger.warn(String.format("根据当前手机号(%s)密码未找到所属组织,密码错误",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();
@ -371,7 +371,7 @@ public class GovLoginServiceImpl implements GovLoginService {
if(result.success()&&null!=result.getData()){
return result.getData();
}
logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s",
logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s",
ServiceConstant.GOV_ORG_SERVER,
formDTO.getMobile(),
formDTO.getPassword(),
@ -467,7 +467,7 @@ public class GovLoginServiceImpl implements GovLoginService {
public String getOrgIdPath(String staffId) {
Result<CustomerAgencyDTO> result = govOrgFeignClient.getAgencyByStaff(staffId);
if (!result.success()) {
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
logger.warn("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
return null;
}
CustomerAgencyDTO agency = result.getData();
@ -485,7 +485,7 @@ public class GovLoginServiceImpl implements GovLoginService {
public CustomerAgencyDTO getAgencyByStaffId(String staffId) {
Result<CustomerAgencyDTO> result = govOrgFeignClient.getAgencyByStaff(staffId);
if (!result.success()) {
logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
logger.warn("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg());
return null;
}
return result.getData();

1
epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java

@ -106,6 +106,7 @@ public class GovWebServiceImpl implements GovWebService {
logger.info("app:" + formDTO.getApp() + ";client:" + formDTO.getClient() + ";userId:" + userId + ";生成token[" + token + "]");
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
tokenDto.setCustomerId(formDTO.getCustomerId());
tokenDto.setApp(formDTO.getApp());
tokenDto.setClient(formDTO.getClient());
tokenDto.setUserId(userId);

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

@ -30,6 +30,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -74,6 +75,9 @@ public class SsoServiceImpl implements SsoService {
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Value("${epmet.third.urlPrefix}")
private String epmetThirdUrlPrefix;
/**
* @Description 0入口得到token
* @Param formDTO
@ -81,8 +85,9 @@ public class SsoServiceImpl implements SsoService {
* @date 2021/1/18 下午4:59
*/
@Override
public SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO) {
public SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO) {
String customerId = getCustomerId(formDTO.getAppId());
//String customerId = "3a4f923665a7a07701bcb311aac9a156";
String userId = "";
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId));
@ -97,7 +102,7 @@ public class SsoServiceImpl implements SsoService {
ThirdPlatUserInfo userInfo;
try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket());
userInfo = apiService.getCUserInfoByTicket(formDTO.getTicket());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
@ -140,7 +145,7 @@ public class SsoServiceImpl implements SsoService {
ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform());
String apiService = platformEnum.getApiService();
AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService);
thirdUser = apiServiceImpl.getUserInfoByTicket(formDTO.getThirdToken());
thirdUser = apiServiceImpl.getGUserInfoBySSOToken(formDTO.getThirdToken());
} catch (RenException e) {
throw new RenException(e.getCode(), e.getMessage());
} catch (Exception e) {
@ -155,14 +160,14 @@ public class SsoServiceImpl implements SsoService {
form.setMobile(thirdUser.getMobile());
Result<GovWebOperLoginResultDTO> result = epmetUserFeignClient.getStaffIdAndPwd(form);
//todo userId 写死测试 3f7f852ce22c511aa67ecb695395295d start
GovWebOperLoginResultDTO demo = new GovWebOperLoginResultDTO();
/* GovWebOperLoginResultDTO demo = new GovWebOperLoginResultDTO();
demo.setUserId("3f7f852ce22c511aa67ecb695395295d");
result = new Result<>();
result.ok(demo);
result.ok(demo);*/
//test end
if (!result.success() || null == result.getData() || null == result.getData().getUserId()) {
logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在");
logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在,param:{}", JSON.toJSONString(form));
throw new RenException(EpmetErrorCode.ERR10003.getCode());
}
@ -230,7 +235,7 @@ public class SsoServiceImpl implements SsoService {
*/
public String getCustomerId(String appId){
JSONObject jsonObject = new JSONObject();
String customerMsgUrl = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/";
String customerMsgUrl = epmetThirdUrlPrefix + "/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);
@ -256,10 +261,11 @@ public class SsoServiceImpl implements SsoService {
* @Description 1ticket自动登录获取内部token
**/
@Override
public UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO) {
public UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO) {
//1.根据appId查询客户id
String customerId = getCustomerId(formDTO.getAppId());
//String customerId = "3a4f923665a7a07701bcb311aac9a156";
//2.客户Id换取第三方apiService,根据ticket换取华为Id
Result<ThirdplatApiserviceResultDTO> apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId));
@ -272,7 +278,7 @@ public class SsoServiceImpl implements SsoService {
ThirdPlatUserInfo userInfo;
try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket());
userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
@ -354,7 +360,7 @@ public class SsoServiceImpl implements SsoService {
int expire = jwtTokenProperties.getExpire();
GovTokenDto govTokenDto = new GovTokenDto();
govTokenDto.setApp(LoginConstant.APP_GOV);
govTokenDto.setClient(LoginConstant.CLIENT_WXMP);
govTokenDto.setClient(LoginConstant.CLIENT_APP);
govTokenDto.setUserId(staffLatestAgency.getStaffId());
govTokenDto.setOpenId(userInfo.getOpenId());
govTokenDto.setSessionKey("");
@ -480,21 +486,21 @@ public class SsoServiceImpl implements SsoService {
//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());
throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg());
}
if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) {
throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString());
}
ThirdPlatUserInfo userInfo;
try {
AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName());
userInfo = apiService.getUserInfoByTicket(formDTO.getTicket());
userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
if (null == userInfo){
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
"【SSO登录】调用第三方平台查询用户信息失败,用户信息为空");
"【SSO enterOrg】调用第三方平台查询用户信息失败,用户信息为空");
}
//3、记录staff_wechat,并记录用户激活状态,激活时间

6
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -401,7 +401,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
//0、验证码是否正确
String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile());
if (!formDTO.getSmsCode().equals(rightSmsCode)) {
logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
logger.warn(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg()));
throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//1.根据appId查询对应客户Id
@ -480,12 +480,12 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
}
//根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码
if(!havePasswordFlag){
logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile()));
logger.warn(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
//密码错误
if(!passwordRightFlag){
logger.error(String.format("根据当前手机号(%s)密码未找到所属组织,密码错误",formDTO.getMobile()));
logger.warn(String.format("根据当前手机号(%s)密码未找到所属组织,密码错误",formDTO.getMobile()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();

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

@ -1,5 +1,6 @@
server:
port: @server.port@
version: @version@
servlet:
context-path: /auth
@ -70,7 +71,7 @@ feign:
config:
default:
loggerLevel: BASIC
httpclient:
okhttp:
enabled: true
hystrix:
@ -135,12 +136,24 @@ shutdown:
# 调用第三方平台相关参数
thirdplat:
jcet:
domain: @thirdplat.jcet.domain@
appkey: @thirdplat.jcet.appkey@
appsecret: @thirdplat.jcet.appsecret@
jcetCend:
domain: @thirdplat.jcet.c.domain@
appkey: @thirdplat.jcet.c.appkey@
appsecret: @thirdplat.jcet.c.appsecret@
jcetGend:
domain: @thirdplat.jcet.g.domain@
appkey: @thirdplat.jcet.g.appkey@
appsecret: @thirdplat.jcet.g.appsecret@
pyld:
domain: https://epmet-ext9.elinkservice.cn/platform
appId: 7a5aec009ba4eba8e254ee64fe3775e1
appKey: 14faef9af508d1c253b720ea5a43f9de
appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595
epmet:
login:
publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKjgDaHWqWgquoatbC4zzQCgqE8C425VIOyzJVVgH1HUYCHpuNUnGCv3HBAl2RsziWQqQgd1xxl0C3a5J4J69o8CAwEAAQ==
privateKey: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAqOANodapaCq6hq1sLjPNAKCoTwLjblUg7LMlVWAfUdRgIem41ScYK/ccECXZGzOJZCpCB3XHGXQLdrkngnr2jwIDAQABAkAyYaWvgrtHuHetdk+v+QRQC54q9FGluP/5nfilX+f4IUf8j92o/ZohTtmJn9qcDiAP4wxCLIsfy4IW3psST78BAiEA0A/E0WvtI7spWnjfw+wMDhdVMIbIJvDbj/cqMwRZInUCIQDPyO2sbXpwDjmAvyn0jpGJJxU5POWYdI37rTf9fScMcwIhAMkWNHbjBHKANVuHb10ACjakPmWEHnXkW5AspdBg53TxAiARPbzq99KXBbcjxbj3f/T3inSqYTEz60f0wDTLJd1dnQIhAIFe6Jd1TduIxGk1PDh/b/3q0jNGgVXkFnUBnKWDaL9N
# third服务的相关配置
third:
urlPrefix: @epmet.third.urlprefix@

2
epmet-auth/src/main/resources/logback-spring.xml

@ -139,7 +139,7 @@
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<springProfile name="local,dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet" level="INFO"/>

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

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

4
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java

@ -17,5 +17,9 @@ public interface ConsomerGroupConstants {
* 初始化客户组织机构信息分组
*/
String INIT_CUSTOMER_ORG_ROLES_GROUP = "init_customer_org_roles_group";
/**
* 客户初始化议题项目分类标签数据
*/
String ISSUE_PROJECT_CATEGORY_TAG = "issue_project_category_tag";
}

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

@ -20,7 +20,7 @@ public class DemoApp {
//ssoToken.setSsoToken("wxz");
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket("wxz");
ssoTicket.setSsoTicket("ssoTicket-jGOAW66udmRtUWBKgs3q7k1w7prGxd5I");
int bodyLength = JSON.toJSONString(ssoTicket).getBytes("utf-8").length;

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

@ -19,7 +19,15 @@ public abstract class AbstractApiService {
* @return
* @throws Exception
*/
public abstract ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws Exception;
public abstract ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception;
/**
* G端用户token获取用户信息
* @param token
* @return
* @throws Exception
*/
public abstract ThirdPlatUserInfo getGUserInfoBySSOToken(String token) throws Exception;
/**
* @Description 解析请求结果

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

@ -5,7 +5,8 @@ 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.dto.result.jcet.JcetCUserInfoResultDTO;
import com.epmet.commons.thirdplat.dto.result.jcet.JcetGUserInfoResultDTO;
import com.epmet.commons.thirdplat.encrypt.SignUtils;
import com.epmet.commons.thirdplat.properties.JcetThirdplatProps;
import com.epmet.commons.thirdplat.properties.ThirdplatProps;
@ -16,20 +17,20 @@ 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;
private JcetThirdplatProps jcetThirdplatCendProps;
private JcetThirdplatProps jcetThirdplatGendProps;
public JcetApiService(ThirdplatProps props) {
this.thirdplatProps = props;
jcetThirdplatProps = props.getJcet();
jcetThirdplatCendProps = props.getJcetCend();
jcetThirdplatGendProps = props.getJcetGend();
}
/**
@ -38,8 +39,7 @@ public class JcetApiService extends AbstractApiService {
* @author wxz
* @date 2021.01.19 10:26
*/
@Override
public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket);
@ -47,12 +47,12 @@ public class JcetApiService extends AbstractApiService {
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket(ticket);
String domain = jcetThirdplatProps.getDomain();
String domain = jcetThirdplatCendProps.getDomain();
Result<String> result = HttpClientManager.getInstance().sendPost(
domain.concat(JcetConstants.URL_GET_USER_BY_TICKET),
domain.startsWith("https://"),
JSON.toJSONString(ssoTicket),
getHeaders(ssoTicket));
getHeaders(JSON.toJSONString(ssoTicket).getBytes("utf-8").length, jcetThirdplatCendProps.getAppkey(), jcetThirdplatCendProps.getAppsecret()));
try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
@ -61,7 +61,7 @@ public class JcetApiService extends AbstractApiService {
}
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class);
JcetCUserInfoResultDTO resultDTO = parseResult(result, JcetCUserInfoResultDTO.class);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();
userInfo.setOpenId(resultDTO.getId());
@ -70,6 +70,38 @@ public class JcetApiService extends AbstractApiService {
return userInfo;
}
@Override
public ThirdPlatUserInfo getGUserInfoBySSOToken(String token) throws Exception {
logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口入参 ticket:{}", token);
HashMap<String, Object> params = new HashMap<>();
params.put("ssoToken",token);
String domain = jcetThirdplatGendProps.getDomain();
Result<String> result = HttpClientManager.getInstance().sendGet(
domain.concat(JcetConstants.URL_GET_USER_BY_TOKEN),
domain.startsWith("https://"),
params,
getHeaders(0, jcetThirdplatGendProps.getAppkey(), jcetThirdplatGendProps.getAppsecret()));
try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
} catch (Exception e) {
//e.printStackTrace();
}
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
JcetGUserInfoResultDTO resultDTO = parseResult(result, JcetGUserInfoResultDTO.class);
ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo();
userInfo.setOpenId(resultDTO.getUid());
userInfo.setName(resultDTO.getName());
userInfo.setMobile(resultDTO.getMobile());
return userInfo;
}
/**
* @return
* @Description 通过token获取用户信息
@ -98,19 +130,17 @@ public class JcetApiService extends AbstractApiService {
/**
* 获取请求所需要的头信息
*
* @param contentObject
* @return
* @throws UnsupportedEncodingException
*/
private Map<String, Object> getHeaders(Object contentObject) throws UnsupportedEncodingException {
int bodyLength = JSON.toJSONString(contentObject).getBytes(StandardCharsets.UTF_8).length;
private Map<String, Object> getHeaders(int bodyLength, String appKey, String appSecret) throws UnsupportedEncodingException {
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()));
headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, timestamp);
headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, appKey);
String encryptContent = appKey + timestamp + bodyLength;
headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, appSecret));
return headers;
}

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

@ -40,6 +40,11 @@ public class PyldApiService extends AbstractApiService {
pyldThirdplatProps = props.getPyld();
}
@Override
public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception {
return null;
}
/**
* @return
* @Description 通过第三方平台ticket获取用户信息
@ -47,7 +52,7 @@ public class PyldApiService extends AbstractApiService {
* @date 2021.01.19 10:26
*/
@Override
public ThirdPlatUserInfo getUserInfoByTicket(String platformToken) {
public ThirdPlatUserInfo getGUserInfoBySSOToken(String platformToken) {
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken);

2
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java → epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java

@ -3,7 +3,7 @@ package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data;
@Data
public class JcetUserInfoResultDTO {
public class JcetCUserInfoResultDTO {
private String id;
/**
* 用户名称

25
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.commons.thirdplat.dto.result.jcet;
import lombok.Data;
@Data
public class JcetGUserInfoResultDTO {
private String uid;
/**
* 手机号码
*/
private String mobile;
/**
* 姓名
*/
private String name;
/**
* 账号
*/
private String account;
/**
* 用户编码
*/
private String code;
}

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

@ -6,10 +6,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Data
@ConfigurationProperties(prefix = "thirdplat")
public class ThirdplatProps {
/**
* 泸州 酒城e通
*/
private JcetThirdplatProps jcet;
// C端
private JcetThirdplatProps jcetCend;
// G端
private JcetThirdplatProps jcetGend;
/**
* 平阴联动指挥平台
*/

5
epmet-commons/epmet-commons-tools/pom.xml

@ -149,6 +149,11 @@
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<!-- 钉钉机器人 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
</dependency>
</dependencies>
<build>

24
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java

@ -1,24 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.annotation;
import java.lang.annotation.*;
/**
* 操作日志注解
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface LogOperation {
String value() default "";
}

26
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

@ -7,18 +7,14 @@ import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
@ -35,19 +31,20 @@ public class NoRepeatSubmitAop {
/**
* 重复提交判断时间为2s
*/
private static final Cache<String, Object> CACHES = CacheBuilder.newBuilder()
private static final Cache<String, Integer> CACHES = CacheBuilder.newBuilder()
// 最大缓存 100 个
.maximumSize(1000)
.maximumSize(100)
// 设置写缓存后 5 秒钟过期
.expireAfterWrite(5, TimeUnit.SECONDS)
.build();
@Before("execution(public * com.epmet..*Controller.*(..))")
public void before(JoinPoint joinPoint) {
System.out.println(joinPoint.getSignature().getName());
@Pointcut("@annotation(com.epmet.commons.tools.aop.NoRepeatSubmit)")
public void doAspect() {
}
@Around("execution(public * com.epmet..*Controller.*(..)) && @annotation(com.epmet.commons.tools.aop.NoRepeatSubmit)")
public Object around(ProceedingJoinPoint pjp) {
@Before("doAspect()")
public void around(JoinPoint pjp) {
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
assert attributes != null;
@ -55,9 +52,7 @@ public class NoRepeatSubmitAop {
String key = getKey(request.getRequestURI(), pjp.getArgs());
// 如果缓存中有这个url视为重复提交
if (CACHES.getIfPresent(key) == null) {
Object o = pjp.proceed();
CACHES.put(key, NumConstant.ZERO);
return o;
} else {
log.error("重复提交");
throw new RenException(EpmetErrorCode.REPEATED_SUBMIT_ERROR.getCode());
@ -68,7 +63,6 @@ public class NoRepeatSubmitAop {
log.error("验证重复提交时出现未知异常!");
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
}
private String getKey(String keyExpress, Object[] args) {
@ -79,4 +73,4 @@ public class NoRepeatSubmitAop {
}
}
}

84
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java

@ -0,0 +1,84 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.commons.tools.aspect;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.taobao.api.ApiException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
/**
* 应用 启动健康检查 通知类
* CustomerApplicationRunner
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Component
public class ApplicationFailedEventListener implements ApplicationListener<ApplicationFailedEvent> {
private static Logger logger = LogManager.getLogger(ApplicationFailedEventListener.class);
@Value("${spring.application.name}")
private String appName;
@Value("${server.version}")
private String version;
@Override
public void onApplicationEvent(ApplicationFailedEvent applicationFailedEvent) {
Throwable exception = applicationFailedEvent.getException();
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
logger.info(currentEnv);
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) {
sendDingMarkDownMsg(exception);
}
}
private String getServerIp() {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
private void sendDingMarkDownMsg(Throwable exception) {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5");
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("markdown");
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
markdown.setTitle("部署失败通知");
markdown.setText("部署失败通知 \n" +
"> 服务:" + appName + "\n\n" +
"> 版本:" + version + "\n\n" +
"> 环境:" + EnvEnum.getCurrentEnv().getName() + "\n\n" +
"> IP: " + getServerIp() + "\n\n" +
"> 异常:" + exception.getMessage() + "\n\n"
);
request.setMarkdown(markdown);
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setIsAtAll(true);
request.setAt(at);
try {
OapiRobotSendResponse execute = client.execute(request);
logger.info("=====通知结果===>" + JSON.toJSONString(execute));
} catch (ApiException e) {
logger.error("sendDingMarkDownMsg exception", e);
}
}
}

109
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java

@ -0,0 +1,109 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.commons.tools.aspect;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import com.taobao.api.ApiException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
/**
* 应用 启动健康检查 通知类
* CustomerApplicationRunner
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Component
public class ApplicationReadyEventListener implements ApplicationListener<ApplicationReadyEvent> {
private static Logger logger = LogManager.getLogger(ApplicationReadyEventListener.class);
@Value("${spring.application.name}")
private String appName;
@Value("${server.version}")
private String version;
@Override
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
logger.info(currentEnv);
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) {
//sendDingTextMsg();
sendDingMarkDownMsg();
}
}
private void sendDingTextMsg() {
//发送启动成功消息
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
//开发小组 群机器人地址
String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(EnvEnum.getCurrentEnv().getName())
.append("【")
.append(appName)
.append("】")
.append("ip地址: ")
.append(serverIp)
.append("部署完毕!");
DingTalkTextMsg msg = new DingTalkTextMsg();
msg.setWebHook(url);
msg.setAtAll(true);
msg.setContent(stringBuilder.toString());
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent());
logger.info(stringResult);
}
private String getServerIp() {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
private void sendDingMarkDownMsg() {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5");
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("markdown");
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
markdown.setTitle("部署成功通知");
markdown.setText("部署成功通知 \n" +
"> 服务:" + appName + "\n\n" +
"> 版本:" + version + "\n\n" +
"> 环境:" + EnvEnum.getCurrentEnv().getName() + "\n\n" +
"> IP: " + getServerIp() + "\n\n"
);
request.setMarkdown(markdown);
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
at.setIsAtAll(true);
request.setAt(at);
try {
OapiRobotSendResponse execute = client.execute(request);
logger.info("=====通知结果===>" + JSON.toJSONString(execute));
} catch (ApiException e) {
logger.error("sendDingMarkDownMsg exception", e);
}
}
}

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java

@ -1,6 +1,7 @@
package com.epmet.commons.tools.aspect;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.exception.*;
import com.epmet.commons.tools.utils.Result;
import org.apache.commons.lang3.StringUtils;
@ -12,6 +13,7 @@ import org.springframework.dao.DuplicateKeyException;
import javax.servlet.http.HttpServletRequest;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Arrays;
/**
* 日志切面
@ -61,6 +63,7 @@ public abstract class BaseRequestLogAspect {
try {
Object[] args = point.getArgs();
ThreadLocalConstant.requestParam.set(Arrays.toString(point.getArgs()));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args));
result = point.proceed();
resultInfoLog(transactionSerial, getExecPeriod(startTime), result);
@ -74,7 +77,7 @@ public abstract class BaseRequestLogAspect {
return result;
} catch (ValidateException e) {
result = handleValidateException(e);
resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e));
resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e));
} catch (DuplicateKeyException e) {
result = handlerDuplicateKeyException(e);
resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMessage(), ExceptionUtils.getErrorStackTrace(e));

67
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java

@ -1,67 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.commons.tools.aspect;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* 应用 启动健康检查 通知类
* CustomerApplicationRunner
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Component
@Order(value = 99)
public class CustomerApplicationRunner implements ApplicationRunner {
private static Logger logger = LogManager.getLogger(CustomerApplicationRunner.class);
@Value("${spring.application.name}")
private String appName;
@Override
public void run(ApplicationArguments args) {
//发送启动成功消息
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
logger.info(currentEnv);
if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
//开发小组 群机器人地址
String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(EnvEnum.getCurrentEnv().getName())
.append("【")
.append(appName)
.append("】")
.append("ip地址: ")
.append(serverIp)
.append("部署完毕!");
DingTalkTextMsg msg = new DingTalkTextMsg();
msg.setWebHook(url);
msg.setAtAll(true);
msg.setContent(stringBuilder.toString());
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent());
logger.info(stringResult);
}
}
}

121
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java

@ -1,121 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.aspect;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.config.ModuleConfig;
import com.epmet.commons.tools.security.user.SecurityUser;
import com.epmet.commons.tools.log.SysLogOperation;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.log.enums.OperationStatusEnum;
import com.epmet.commons.tools.log.producer.LogProducer;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.commons.tools.utils.IpUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Date;
/**
* 操作日志切面处理类
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Aspect
@Component
public class LogOperationAspect {
@Autowired
private ModuleConfig moduleConfig;
@Autowired
private LogProducer logProducer;
@Pointcut("@annotation(com.epmet.commons.tools.annotation.LogOperation)")
public void logPointCut() {
}
@Around("logPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
long beginTime = System.currentTimeMillis();
try {
//执行方法
Object result = point.proceed();
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveLog(point, time, OperationStatusEnum.SUCCESS.value());
return result;
}catch(Exception e) {
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveLog(point, time, OperationStatusEnum.FAIL.value());
throw e;
}
}
private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
SysLogOperation log = new SysLogOperation();
LogOperation annotation = method.getAnnotation(LogOperation.class);
if(annotation != null){
//注解上的描述
log.setOperation(annotation.value());
}
//登录用户信息
UserDetail user = SecurityUser.getUser();
if(user != null){
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
}
log.setType(LogTypeEnum.OPERATION.value());
log.setModule(moduleConfig.getName());
log.setStatus(status);
log.setRequestTime((int)time);
log.setCreateDate(new Date());
//请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
log.setIp(IpUtils.getIpAddr(request));
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setRequestUri(request.getRequestURI());
log.setRequestMethod(request.getMethod());
//请求参数
Object[] args = joinPoint.getArgs();
try{
String params = JSON.toJSONString(args[0]);
log.setRequestParams(params);
}catch (Exception e){
}
//保存到Redis队列里
logProducer.saveLog(log);
}
}

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

@ -26,6 +26,7 @@ public interface NumConstant {
int TEN = 10;
int ELEVEN = 11;
int TWELVE = 12;
int THIRTEEN = 13;
int SEVENTEEN = 17;
int FIFTEEN = 15;
int FOURTEEN=14;
@ -62,6 +63,10 @@ public interface NumConstant {
String THREE_STR = "3";
String FOUR_STR = "4";
String FIVE_STR = "5";
String SIX_STR = "6";
String SEVEN_STR = "7";
String EIGHT_STR = "8";
String NINE_STR = "9";
String POSITIVE_EIGHT_STR = "+8";
String EMPTY_STR = "";
String ONE_NEG_STR = "-1";

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java

@ -81,4 +81,6 @@ public interface StrConstant {
String MIN="MIN";
String MAX="MAX";
String SPECIAL_CUSTOMER = "150282ed25c14ff0785e7e06283b6283";
}

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java

@ -1,7 +1,5 @@
package com.epmet.commons.tools.constant;
import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO;
/**
* ThreadLocal常亮
*/
@ -16,4 +14,9 @@ public class ThreadLocalConstant {
* 用于向DataFilterInterceptor传递权限过滤的sql片段(需要在Controller相关的AOP中进行清理防止变量残留)
*/
public static final ThreadLocal<String> sqlFilter = new ThreadLocal();
/**
* 用于本次的获取请求参数
*/
public static final ThreadLocal<String> requestParam = new ThreadLocal();
}

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

@ -125,9 +125,12 @@ public enum EpmetErrorCode {
// 党建声音 前端提示 88段
DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"),
ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"),
REPEATED_SUBMIT_ERROR(8998, "请勿重复提交"),
CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"),
DRAFT_CONTENT_FILENAME_NULL(8802, "附件名称不能为空"),
ARTICLE_PUBLISH_ERROR(8803, "发布文章失败,请刷新重试"),
REPEATED_SUBMIT_ERROR(8804, "请勿重复提交"),
CUSTOMER_VALIDATE_ERROR(8805, "内部数据校验异常"),
CATEGORY_IS_NULL(8806, "请设置分类"),
//公众号 865..开头的码
PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"),
@ -143,7 +146,10 @@ public enum EpmetErrorCode {
TOPIC_SHIFTED_TO_ISSUE_UNDER_AUDITING(9004,"当前话题正在转议题审核"),
TOPIC_ALREADY_SHIFTED_TO_ISSUE(9005,"该话题已被转为议题,请勿重复操作"),
TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"),
TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题");
TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"),
CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"),
CATEGORY_NAME(9102,"分类名称已存在,不允许重复");
private int code;
private String msg;

153
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java

@ -1,153 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.exception;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.config.ModuleConfig;
import com.epmet.commons.tools.log.SysLogError;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.log.producer.LogProducer;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Map;
/**
* 异常处理器
* 暂停使用,改用BaseRequestLogAspect
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
//@RestControllerAdvice
public class RenExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class);
@Autowired
private ModuleConfig moduleConfig;
@Autowired
private LogProducer logProducer;
@Autowired
private LoginUserUtil loginUserUtil;
/**
* 处理自定义异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(RenException.class)
public Result handleRRException(RenException ex){
if (ex.getCode() > 8000) {
Result result=new Result().error(ex.getCode());
result.setData(ex.getInternalMsg());
return result;
}
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result().error();
result.setData(ex.getInternalMsg());
return result;
// return new Result().error();
}
/**
* 处理自定义异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(ValidateException.class)
public Result handleVException(ValidateException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result();
result.setCode(ex.getCode());
result.setMsg(ex.getMsg());
return result;
// return new Result().error();
}
/**
* 运行时异常拦截
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(RuntimeException.class)
public Result handleRuntimeException(RuntimeException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result().error();
result.setData(ex.getMessage());
return result;
// return new Result().error();
}
/**
* 处理自定义异常
* "code": 10002,
* "msg": "数据库中已存在该记录",
*/
@ExceptionHandler(DuplicateKeyException.class)
public Result handleDuplicateKeyException(DuplicateKeyException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
return new Result().error(ErrorCode.DB_RECORD_EXISTS);
}
/**
* 异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(Exception.class)
public Result handleException(Exception ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
// saveLog(ex);
Result result=new Result().error();
result.setData(ex.getMessage());
return result;
// return new Result().error();
}
/**
* 保存异常日志
*/
private void saveLog(Exception ex){
SysLogError log = new SysLogError();
log.setType(LogTypeEnum.ERROR.value());
log.setModule(moduleConfig.getName());
//请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setRequestUri(request.getRequestURI());
log.setRequestMethod(request.getMethod());
log.setIp(IpUtils.getIpAddr(request));
Map<String, String> params = HttpContextUtils.getParameterMap(request);
if(MapUtil.isNotEmpty(params)){
log.setRequestParams(JSON.toJSONString(params));
}
//登录用户ID
log.setCreator(loginUserUtil.getLoginUserId());
//异常信息
log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex));
//保存到Redis队列里
log.setCreateDate(new Date());
logProducer.saveLog(log);
}
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java

@ -53,6 +53,6 @@ public class FeignConfig implements RequestInterceptor {
@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;//控制台会输出debug日志
return Logger.Level.BASIC;//控制台会输出debug日志
}
}

135
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java

@ -6,6 +6,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.IThrowableProxy;
import ch.qos.logback.classic.spi.StackTraceElementProxy;
import ch.qos.logback.core.spi.FilterReply;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.DingdingMsgSender;
@ -15,9 +16,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.core.env.Environment;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -64,14 +68,26 @@ public class LogMsgSendFilter extends LevelFilter {
stringBuilder.append("IP地址:" + serverIp);
stringBuilder.append("\n");
}
stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp()));
stringBuilder.append("\n");
stringBuilder.append("TraceId:" + Thread.currentThread().getName());
stringBuilder.append("\n");
HttpServletRequest request = getRequest();
if (request != null) {
String requestURI = request.getRequestURI();
stringBuilder.append("请求路径:" + requestURI);
stringBuilder.append("\n");
stringBuilder.append("请求参数:" + ThreadLocalConstant.requestParam.get());
stringBuilder.append("\n");
}
String formattedMessage = event.getFormattedMessage();
IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwableProxy == null && formattedMessage.length() > 1000) {
formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5));
formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5));
}
stringBuilder.append("告警信息:" + formattedMessage);
stringBuilder.append("\n");
@ -107,6 +123,9 @@ public class LogMsgSendFilter extends LevelFilter {
try {
if (serverIp == null) {
InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class);
if (inetUtils.findFirstNonLoopbackHostInfo() == null){
return;
}
serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
}
} catch (Exception e) {
@ -159,105 +178,19 @@ public class LogMsgSendFilter extends LevelFilter {
}
}
public static void main(String[] args) {
String msg = "<<<<<<<<异常响应<<<<<<<<:事务流水号:na1597027822634, 执行时长:59ms, 响应数据:{\"code\":8102,\"internalMsg\":\"验证码错误\",\"msg\":\"验证码错误\"}, 异常信息:验证码错误, 堆栈信息:com.epmet.commons.tools.exception.RenException: \n" +
" at com.epmet.service.impl.VolunteerInfoServiceImpl.authenticate(VolunteerInfoServiceImpl.java:91)\n" +
" at com.epmet.service.impl.VolunteerInfoServiceImpl$$FastClassBySpringCGLIB$$7babb2e8.invoke(<generated>)\n" +
" at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" +
" at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" +
" at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" +
" at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)\n" +
" at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)\n" +
" at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
" at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" +
" at com.epmet.service.impl.VolunteerInfoServiceImpl$$EnhancerBySpringCGLIB$$f78b4778.authenticate(<generated>)\n" +
" at com.epmet.controller.ResiVolunteerController.authenticate(ResiVolunteerController.java:59)\n" +
" at com.epmet.controller.ResiVolunteerController$$FastClassBySpringCGLIB$$e023fb55.invoke(<generated>)\n" +
" at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" +
" at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" +
" at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" +
" at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56)\n" +
" at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
" at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)\n" +
" at com.epmet.commons.tools.aspect.BaseRequestLogAspect.proceed(BaseRequestLogAspect.java:66)\n" +
" at com.epmet.aspect.RequestLogAspect.proceed(RequestLogAspect.java:26)\n" +
" at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)\n" +
" at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" +
" at java.lang.reflect.Method.invoke(Method.java:498)\n" +
" at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)\n" +
" at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)\n" +
" at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)\n" +
" at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
" at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)\n" +
" at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" +
" at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" +
" at com.epmet.controller.ResiVolunteerController$$EnhancerBySpringCGLIB$$1c0751c0.authenticate(<generated>)\n" +
" at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" +
" at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n" +
" at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" +
" at java.lang.reflect.Method.invoke(Method.java:498)\n" +
" at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)\n" +
" at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)\n" +
" at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)\n" +
" at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)\n" +
" at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)\n" +
" at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\n" +
" at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)\n" +
" at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)\n" +
" at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)\n" +
" at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)\n" +
" at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)\n" +
" at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)\n" +
" at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)\n" +
" at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)\n" +
" at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)\n" +
" at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94)\n" +
" at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)\n" +
" at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)\n" +
" at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n" +
" at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" +
" at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" +
" at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)\n" +
" at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)\n" +
" at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)\n" +
" at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)\n" +
" at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\n" +
" at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)\n" +
" at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\n" +
" at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)\n" +
" at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)\n" +
" at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)\n" +
" at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1591)\n" +
" at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n" +
" at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n" +
" at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n" +
" at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n" +
" at java.lang.Thread.run(Thread.java:745)";
/**
* 获取Request对象
*
* @return
*/
private HttpServletRequest getRequest() {
RequestAttributes ra = RequestContextHolder.getRequestAttributes();
ServletRequestAttributes sra = (ServletRequestAttributes) ra;
if (sra == null){
return null;
}
return sra.getRequest();
String substring = msg.substring(0, getCharacterPosition(msg, "com.epme1t", 5));
System.out.println(substring);
}
@ -274,7 +207,7 @@ public class LogMsgSendFilter extends LevelFilter {
}
return slashMatcher.start();
} catch (Exception e) {
logger.warn("getCharacterPosition no matche");
logger.warn("getCharacterPosition no matche", e);
return 0;
}
}

43
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java

@ -1,43 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.log.producer;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.epmet.commons.tools.log.BaseLog;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.*;
/**
* 日志通过redis队列异步保存到数据库
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Component
public class LogProducer {
@Autowired
private RedisUtils redisUtils;
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("log-producer-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(5, 200, 0L,TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
/**
* 保存Log到Redis消息队列
*/
public void saveLog(BaseLog log){
String key = RedisKeys.getSysLogKey();
//异步保存到队列
pool.execute(() -> redisUtils.leftPush(key, log, RedisUtils.NOT_EXPIRE));
}
}

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

@ -9,6 +9,7 @@
package com.epmet.commons.tools.redis;
import com.epmet.commons.tools.constant.StrConstant;
import org.apache.commons.lang3.StringUtils;
/**
* @author Mark sunlightcs@gmail.com
@ -42,13 +43,6 @@ public class RedisKeys {
return rootPrefix.concat("sys:security:user:").concat(String.valueOf(id));
}
/**
* 系统日志Key
*/
public static String getSysLogKey() {
return rootPrefix.concat("sys:log");
}
/**
* 系统资源Key
*/
@ -355,19 +349,64 @@ public class RedisKeys {
}
/**
* @return
* @Description 客户的ApiService
* @author wxz
* @date 2021.01.20 16:56
*/
public static String getCustomerApiServiceKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId);
}
/**
* @return epmet:resi:user:userId
* @Description 用户缓存Key
* @Param 用户Id
* @Author wangc
* @Date 2020.04.13 11:27
**/
public static String getResiUserKey(String userId){
public static String getResiUserKey(String userId) {
return rootPrefix.concat("resi:user:").concat(userId);
}
/**
* @Description 客户的ApiService
* @param userId
* @return epmet:badge:user:[customerId]:[userId]
* @Description 用户勋章缓存 epmet:badge:user:[customerId]:[userId]
* @author wangc
* @date 2020.11.05 13:34
*/
public static String getResiUserBadgeKey(String customerId, String userId) {
return rootPrefix.concat("badge:user:").concat(customerId).concat(":").concat(StringUtils.isBlank(userId) ? "*" : userId);
}
/**
* desc: 根据文件路径获取oss 文件缓存key
*
* @param path
* @return java.lang.String
* @author LiuJanJun
* @date 2021/3/30 9:56 上午
*/
public static String getOssFileKey(String path) {
return rootPrefix.concat("oss:temp:").concat(path);
}
/**
* 一个客户对应多个第三方平台多个ApiService的key
* @param customerId
* @return
* @author wxz
* @date 2021.01.20 16:56
*/
public static String getCustomerApiServiceKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId);
public static String listCustomerApiServiceListKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservicelist:").concat(customerId);
}
/**
* 查询第三方平台access token
* @param platformId
* @return
*/
public static String getThirdPlatformAccessTokenKey(String platformId) {
return rootPrefix.concat("thirdplatform:accesstoken:").concat(platformId);
}
}

45
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java

@ -206,6 +206,17 @@ public class RedisUtils {
}).collect(Collectors.toList());
}
/**
* @Description 获取缓存List
* @Param key
* @author zxc
* @date 2021/3/30 下午3:33
*/
public List<Object> getListLrange(String key){
List<Object> range = redisTemplate.opsForList().range(key, 0, -1);
return range;
}
/**
* @Description Redis lrem :
* 根据参数 count 的值移除列表中与参数 value 相等的元素
@ -357,6 +368,18 @@ public class RedisUtils {
return typedTuples;
}
public <T> Set<T> zReverseRange(String key, long start, long end, Class<T> clazz) {
Set<Object> objects = redisTemplate.opsForZSet().reverseRange(key, start, end);
if(CollectionUtils.isEmpty(objects)) return null;
return objects.stream().map(o->{
try {
T target = clazz.newInstance();
BeanUtils.copyProperties(o, target);
return target;
}catch (Exception e){throw new RenException("convert error");}
}).collect(Collectors.toSet());
}
/**
* @Description 标签使用数量缓存更新
* @param key
@ -368,6 +391,28 @@ public class RedisUtils {
return redisTemplate.opsForZSet().incrementScore(key, value, delta);
}
/**
* @Description 获取某个Zset的score
* @Param key
* @Param o
* @author zxc
* @date 2020/12/9 下午3:07
*/
public Double getScore(String key, Object o){
return redisTemplate.opsForZSet().score(key,o);
}
/**
* @Description zset添加
* @Param key
* @Param o
* @author zxc
* @date 2020/12/9 下午3:18
*/
public void zSetAdd(String key, Object o){
redisTemplate.opsForZSet().add(key,o,NumConstant.ZERO);
}
/**
* @Description 判断key是否存在
* @param key

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java

@ -34,6 +34,18 @@ public class LoginUserUtil {
return userId;
}
/**
* 查询登录用户的客户Id
* @return
*/
public String getCurrentCustomerId() {
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
if (request == null) {
return null;
}
return request.getHeader(AppClientConstant.CUSTOMER_ID);
}
/**
* 登录用户的App头信息
* @return

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

@ -424,6 +424,13 @@ public class DateUtils {
return DateUtils.format(date,DateUtils.DATE_PATTERN_YYYYMMDD);
}
public static String getBeforeNDay(int beforDay,String format){
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, - beforDay);
Date date = c.getTime();
return DateUtils.format(date,format);
}
/**
* @return java.lang.String
* @param beforMonth

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

@ -6,6 +6,9 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
@ -23,6 +26,7 @@ import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
@ -32,16 +36,15 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
@ -62,7 +65,7 @@ public class HttpClientManager {
// 连接超时时间,毫秒
private static int connectionTimeout = 5000;
// 读取数据超时时间,毫秒
private static int soTimeout = 20000;
private static int soTimeout = 45000;
private static String HEADER_CONTENT_TYPE = "Content-Type";
private static String HEADER_APPLICATION_JSON = "application/json;charset=utf-8";
private static String UTF8 = "utf-8";
@ -239,6 +242,32 @@ public class HttpClientManager {
}
}
public Result<String> uploadFile(String url, boolean isHttps, File file, String fileName, Map<String, Object> headerMap) {
try {
HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig);
if (null != headerMap) {
headerMap.forEach((k, v) -> {
if (v != null) {
httppost.addHeader(k, v.toString());
}
});
}
if (file != null) {
HttpEntity entity = MultipartEntityBuilder
.create()
.addBinaryBody("file", file, ContentType.MULTIPART_FORM_DATA, fileName)
.setMode(HttpMultipartMode.RFC6532)
.build();
httppost.setEntity(entity);
}
return execute(httppost,isHttps);
} catch (Exception e) {
log.error("send exception", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
/**
* desc: https发送json post 请求
* param: url,jsonStrParam
@ -349,7 +378,7 @@ public class HttpClientManager {
}
}
public Result<String> sendGet(String url, boolean isHttps, Map<String, Object> params, Map<String,String> headerMap) {
public Result<String> sendGet(String url, boolean isHttps, Map<String, Object> params, Map<String, Object> headerMap) {
try {
URIBuilder builder = new URIBuilder(url);
@ -364,7 +393,9 @@ public class HttpClientManager {
httpGet.setConfig(requestConfig);
if (null != headerMap){
headerMap.forEach((k,v) -> {
httpGet.addHeader(k,v);
if (StringUtils.isNotBlank(k)) {
httpGet.addHeader(k, v == null ? null : v.toString());
}
});
}
return execute(httpGet, isHttps);
@ -434,6 +465,61 @@ public class HttpClientManager {
}
}
public Result<MultipartFile> getFileItem(String url, String fileName) {
try {
URIBuilder builder = new URIBuilder(url);
HttpGet httpGet = new HttpGet(builder.build());
httpGet.setConfig(requestConfig);
return executeToFile(httpGet, fileName);
} catch (Exception e) {
log.error("sendGet exception", e);
return new Result<MultipartFile >().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
private Result<MultipartFile> executeToFile(HttpRequestBase httpMethod, String fileName) {
CloseableHttpResponse response = null;
FileItem item = null;
try {
response = httpclient.execute(httpMethod);
log.debug("http send response:{}", JSON.toJSONString(response));
if (response != null && response.getStatusLine() != null) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
InputStream is = response.getEntity().getContent();
FileItemFactory factory = new DiskFileItemFactory(16, null);
String textFieldName = "file";
item = factory.createItem(textFieldName, ContentType.APPLICATION_OCTET_STREAM.toString(), false, fileName);
OutputStream os = item.getOutputStream();
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
is.close();
return new Result<MultipartFile>().ok(new CommonsMultipartFile(item));
} else {
log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
}
}
} catch (Exception e) {
log.error("execute exception", e);
return new Result<MultipartFile>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} finally {
httpMethod.releaseConnection();
try {
if (response != null) {
response.close();
}
} catch (IOException e) {
}
}
return new Result<MultipartFile>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
public Result<byte[]> getMediaByteArray(String url, String json) {
try {

251
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java

@ -0,0 +1,251 @@
package com.epmet.commons.tools.utils;
import javax.crypto.Cipher;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
/**
* @author jianjun liu
* @date 2020-06-05 16:48
**/
public class RSASignature {
//非对称密钥算法
private static final String KEY_ALGORITHM = "RSA";
//密钥长度,在512到65536位之间,建议不要太长,否则速度很慢,生成的加密数据很长
private static final int KEY_SIZE = 512;
//字符编码
private static final String CHARSET = "UTF-8";
/**
* 生成密钥对
*
* @return KeyPair 密钥对
*/
public static KeyPair getKeyPair() throws Exception {
return getKeyPair(null);
}
/**
* 生成密钥对
*
* @param password 生成密钥对的密码
* @return
* @throws Exception
*/
public static KeyPair getKeyPair(String password) throws Exception {
//实例化密钥生成器
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGORITHM);
//初始化密钥生成器
if (password == null) {
keyPairGenerator.initialize(KEY_SIZE);
} else {
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(password.getBytes(CHARSET));
keyPairGenerator.initialize(KEY_SIZE, secureRandom);
}
//生成密钥对
return keyPairGenerator.generateKeyPair();
}
/**
* 取得私钥
*
* @param keyPair 密钥对
* @return byte[] 私钥
*/
public static byte[] getPrivateKeyBytes(KeyPair keyPair) {
return keyPair.getPrivate().getEncoded();
}
/**
* 取得Base64编码的私钥
*
* @param keyPair 密钥对
* @return String Base64编码的私钥
*/
public static String getPrivateKey(KeyPair keyPair) {
return Base64.getEncoder().encodeToString(getPrivateKeyBytes(keyPair));
}
/**
* 取得公钥
*
* @param keyPair 密钥对
* @return byte[] 公钥
*/
public static byte[] getPublicKeyBytes(KeyPair keyPair) {
return keyPair.getPublic().getEncoded();
}
/**
* 取得Base64编码的公钥
*
* @param keyPair 密钥对
* @return String Base64编码的公钥
*/
public static String getPublicKey(KeyPair keyPair) {
return Base64.getEncoder().encodeToString(getPublicKeyBytes(keyPair));
}
/**
* 私钥加密
*
* @param data 待加密数据
* @param privateKey 私钥字节数组
* @return byte[] 加密数据
*/
public static byte[] encryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception {
//实例化密钥工厂
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
//生成私钥
PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey));
//数据加密
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(data);
}
/**
* 私钥加密
*
* @param data 待加密数据
* @param privateKey Base64编码的私钥
* @return String Base64编码的加密数据
*/
public static String encryptByPrivateKey(String data, String privateKey) throws Exception {
byte[] key = Base64.getDecoder().decode(privateKey);
return Base64.getEncoder().encodeToString(encryptByPrivateKey(data.getBytes(CHARSET), key));
}
/**
* 公钥加密
*
* @param data 待加密数据
* @param publicKey 公钥字节数组
* @return byte[] 加密数据
*/
public static byte[] encryptByPublicKey(byte[] data, byte[] publicKey) throws Exception {
//实例化密钥工厂
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
//生成公钥
PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey));
//数据加密
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(data);
}
/**
* 公钥加密
*
* @param data 待加密数据
* @param publicKey Base64编码的公钥
* @return String Base64编码的加密数据
*/
public static String encryptByPublicKey(String data, String publicKey) throws Exception {
byte[] key = Base64.getDecoder().decode(publicKey);
return Base64.getEncoder().encodeToString(encryptByPublicKey(data.getBytes(CHARSET), key));
}
/**
* 私钥解密
*
* @param data 待解密数据
* @param privateKey 私钥字节数组
* @return byte[] 解密数据
*/
public static byte[] decryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception {
//实例化密钥工厂
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
//生成私钥
PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey));
//数据解密
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(data);
}
/**
* 私钥解密
*
* @param data Base64编码的待解密数据
* @param privateKey Base64编码的私钥
* @return String 解密数据
*/
public static String decryptByPrivateKey(String data, String privateKey) throws Exception {
byte[] key = Base64.getDecoder().decode(privateKey);
return new String(decryptByPrivateKey(Base64.getDecoder().decode(data), key), CHARSET);
}
/**
* 公钥解密
*
* @param data 待解密数据
* @param publicKey 公钥字节数组
* @return byte[] 解密数据
*/
public static byte[] decryptByPublicKey(byte[] data, byte[] publicKey) throws Exception {
//实例化密钥工厂
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
//产生公钥
PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey));
//数据解密
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(data);
}
/**
* 公钥解密
*
* @param data Base64编码的待解密数据
* @param publicKey Base64编码的公钥
* @return String 解密数据
*/
public static String decryptByPublicKey(String data, String publicKey) throws Exception {
byte[] key = Base64.getDecoder().decode(publicKey);
return new String(decryptByPublicKey(Base64.getDecoder().decode(data), key), CHARSET);
}
/**
* 测试加解密方法
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
//生成密钥对,一般生成之后可以放到配置文件中
KeyPair keyPair = RSASignature.getKeyPair();
//公钥
String publicKey = RSASignature.getPublicKey(keyPair);
//私钥
String privateKey = RSASignature.getPrivateKey(keyPair);
System.out.println("公钥:\n" + publicKey);
System.out.println("私钥:\n" + privateKey);
String data = "RSA 加解密测试!";
{
System.out.println("\n===========私钥加密,公钥解密==============");
String s1 = RSASignature.encryptByPrivateKey(data, privateKey);
System.out.println("加密后的数据:" + s1);
String s2 = RSASignature.decryptByPublicKey(s1, publicKey);
System.out.println("解密后的数据:" + s2 + "\n\n");
}
//=====
{
System.out.println("\n===========公钥加密,私钥解密==============");
String s1 = RSASignature.encryptByPublicKey(data, publicKey);
System.out.println("加密后的数据:" + s1);
String s2 = RSASignature.decryptByPrivateKey(s1, privateKey);
System.out.println("解密后的数据:" + s2 + "\n\n");
}
}
}

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

@ -2,6 +2,7 @@ server:
tomcat:
max-swallow-size: 100MB
port: @server.port@
version: @version@
servlet:
context-path: /api
spring:
@ -418,7 +419,7 @@ feign:
config:
default:
loggerLevel: BASIC
httpclient:
okhttp:
enabled: true
hystrix:
@ -456,10 +457,16 @@ epmet:
- /gov/project/**
- /resi/home/**
- /data/report/**
- /epmet/ext/**
- /data/stats/**
- /data/aggregator/**
- /gov/voice/**
- /resi/voice/**
# 内部认证url白名单(在白名单中的,就不会再校验登录了)
internalAuthUrlsWhiteList:
- /epmetuser/customerstaff/customerlist
- /gov/project/project/platformcallback
# 外部应用认证,使用AccessToken等头进行认证
externalOpenUrls:

4
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/GroupConstant.java

@ -5,4 +5,8 @@ package com.epmet.dataaggre.constant;
* @DateTime 2020/12/25 上午10:55
*/
public interface GroupConstant {
String BADGE_ICON = "badgeIcon";
String BADGE_KEY = "epmet:badge:user:";
}

21
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java

@ -0,0 +1,21 @@
package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/3/30 上午11:04
* @DESC
*/
@Data
public class UserInfosResultDTO implements Serializable {
private static final long serialVersionUID = 7129564173128153335L;
private String userId;
private String userShowName;
private String headPhoto;
}

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java

@ -64,6 +64,11 @@ public class ProjectCategoryDTO implements Serializable {
*/
private String categoryPids;
/**
* 分类编码分类编码+customer_id唯一
*/
private String categoryCode;
/**
* 删除标识 0未删除1已删除
*/

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

@ -13,7 +13,20 @@ import java.io.Serializable;
*/
@Data
public class ProjectDistributionFormDTO implements Serializable {
/**
* 网格id不必填
*/
private String gridId;
@NotBlank(message = "customerId不能为空")
private String customerId;
/**
* 默认1
*/
private Integer pageNo;
/**
* 默认20
*/
private Integer pageSize;
}

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.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;
/**
@ -49,7 +50,7 @@ public class ResiTopicCommentDTO implements Serializable {
private String topicId;
/**
* 评论状态
* 评论状态讨论中discussing已屏蔽 :hidden
*/
private String status;

35
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/form/CandidateListFormDTO.java

@ -0,0 +1,35 @@
package com.epmet.dataaggre.dto.resigroup.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/3/30 上午9:34
* @DESC
*/
@Data
public class CandidateListFormDTO implements Serializable {
private static final long serialVersionUID = 6184071611057671961L;
public interface CandidateListForm{}
/**
* 小组ID
*/
@NotBlank(message = "小组ID不能为空",groups = CandidateListForm.class)
private String groupId;
@NotNull(message = "pageNo不能为空",groups = CandidateListForm.class)
private Integer pageNo;
@NotNull(message = "pageSize不能为空",groups = CandidateListForm.class)
private Integer pageSize;
private String customerId;
}

57
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/result/CandidateListResultDTO.java

@ -0,0 +1,57 @@
package com.epmet.dataaggre.dto.resigroup.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/3/30 上午9:15
* @DESC
*/
@Data
public class CandidateListResultDTO implements Serializable {
private static final long serialVersionUID = 4720936429310456924L;
/**
* resi_group_member.id: 成员id
*/
private String memberId;
/**
* 组员的用户id
*/
private String userId;
/**
* 成员头像
*/
private String headPhoto;
/**
* 成员的显示名称
*/
private String userShowName;
/**
* 徽章Url集合
*/
private String leaderFlag;
/**
* leader群主member成员
*/
private List<String> badgeList;
public CandidateListResultDTO() {
this.memberId = "";
this.userId = "";
this.headPhoto = "";
this.userShowName = "";
this.leaderFlag = "";
this.badgeList = new ArrayList<>();
}
}

29
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/ResiGroupController.java

@ -1,8 +1,20 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.annotation.LoginUser;
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.resigroup.form.CandidateListFormDTO;
import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO;
import com.epmet.dataaggre.service.resigroup.ResiGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:45
@ -10,4 +22,21 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("resigroup")
public class ResiGroupController {
@Autowired
private ResiGroupService resiGroupService;
/**
* @Description 可胜任组长-组员列表(工作端通用)
* @Param formDTO
* @author zxc
* @date 2021/3/30 上午9:45
*/
@PostMapping("candidatelist")
public Result<List<CandidateListResultDTO>> candidateList(@RequestBody CandidateListFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, CandidateListFormDTO.CandidateListForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<CandidateListResultDTO>>().ok(resiGroupService.candidateList(formDTO));
}
}

22
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java

@ -18,8 +18,12 @@
package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import com.epmet.dataaggre.entity.epmetuser.UserBaseInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户基础信息
@ -29,5 +33,21 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface UserBaseInfoDao extends BaseDao<UserBaseInfoEntity> {
/**
* @Description 根据UserIds查询
* @Param userIds
* @author zxc
* @date 2021/3/30 上午11:07
*/
List<UserInfosResultDTO> selectUserInfosByUserIds(@Param("userIds") List<String> userIds);
/**
* @Description 查询是党员/热心居民的userId
* @Param userIds
* @author zxc
* @date 2021/4/1 上午9:08
*/
List<String> selectUserIdByCustomerId(@Param("userIds") List<String> userIds);
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiGroupDao.java

@ -18,8 +18,12 @@
package com.epmet.dataaggre.dao.resigroup;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO;
import com.epmet.dataaggre.entity.resigroup.ResiGroupEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 群组信息表
@ -29,5 +33,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ResiGroupDao extends BaseDao<ResiGroupEntity> {
/**
* @Description 根据小组ID查询组员信息身份不包括组长
* @Param groupId
* @author zxc
* @date 2021/3/30 上午10:13
*/
List<CandidateListResultDTO> candidateList(@Param("groupId")String groupId);
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java

@ -20,13 +20,10 @@ package com.epmet.dataaggre.entity.resigroup;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 话题评论表
*
@ -51,7 +48,7 @@ public class ResiTopicCommentEntity extends BaseEpmetEntity {
private String topicId;
/**
* 评论状态
* 评论状态讨论中discussing已屏蔽 :hidden
*/
private String status;

47
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java

@ -0,0 +1,47 @@
package com.epmet.dataaggre.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dataaggre.constant.GroupConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2021/3/30 下午1:39
* @DESC
*/
@Component
@Slf4j
public class ResiGroupRedis {
@Autowired
private RedisUtils redisUtils;
/**
* @Description 获取用户徽章
* @Param customerId
* @Param userId
* @author zxc
* @date 2021/3/30 下午3:33
*/
public List<String> getBadgeInfoByUserId(String customerId,String userId){
String key = GroupConstant.BADGE_KEY+customerId+":"+userId;
List<Object> result = redisUtils.getListLrange(key);
if (!CollectionUtils.isEmpty(result)){
List<String> icons = new ArrayList<>();
for (Object o : result) {
Map<String,String> map = (Map<String, String>) o;
icons.add(map.get(GroupConstant.BADGE_ICON));
}
return icons;
}
return new ArrayList<>();
}
}

21
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java

@ -1,8 +1,29 @@
package com.epmet.dataaggre.service.epmetuser;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/12/25 上午9:20
*/
public interface EpmetUserService {
/**
* @Description 根据UserIds查询
* @Param userIds
* @author zxc
* @date 2021/3/30 上午11:07
*/
List<UserInfosResultDTO> selectUserInfosByUserIds(List<String> userIds);
/**
* @Description 查询是党员/热心居民的userId
* @Param userIds
* @author zxc
* @date 2021/4/1 上午9:08
*/
List<String> selectUserIdByCustomerId(List<String> userIds);
}

30
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -2,10 +2,15 @@ package com.epmet.dataaggre.service.epmetuser.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
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,29 @@ import org.springframework.stereotype.Service;
@DataSource(DataSourceConstant.EPMET_USER)
@Slf4j
public class EpmetUserServiceImpl implements EpmetUserService {
@Autowired
private UserBaseInfoDao userBaseInfoDao;
/**
* @Description 根据UserIds查询
* @Param userIds
* @author zxc
* @date 2021/3/30 上午11:07
*/
@Override
public List<UserInfosResultDTO> selectUserInfosByUserIds(List<String> userIds) {
return userBaseInfoDao.selectUserInfosByUserIds(userIds);
}
/**
* @Description 查询是党员/热心居民的userId
* @Param userIds
* @author zxc
* @date 2021/4/1 上午9:08
*/
@Override
public List<String> selectUserIdByCustomerId(List<String> userIds) {
return userBaseInfoDao.selectUserIdByCustomerId(userIds);
}
}

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

@ -44,5 +44,5 @@ public interface GovIssueService {
**/
List<ClosedIssueListResultDTO> closedIssueList(ClosedIssueListFormDTO fromDTO);
List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId);
List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId,Integer pageNo,Integer pageSize);
}

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

@ -314,8 +314,13 @@ public class GovIssueServiceImpl implements GovIssueService {
}
@Override
public List<IssueInfoDTO> selectShiftProjectIssueList(String customerId,String gridId) {
return issueDao.selectShiftProjectIssueList(customerId,gridId);
public List<IssueInfoDTO> selectShiftProjectIssueList(String customerId, String gridId, Integer pageNo, Integer pageSize) {
if (pageNo != null && pageSize != null) {
PageHelper.startPage(pageNo, pageSize);
}else{
PageHelper.startPage(NumConstant.ONE, NumConstant.TWENTY);
}
return issueDao.selectShiftProjectIssueList(customerId, gridId);
}
}

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

@ -114,7 +114,7 @@ public class GovProjectServiceImpl implements GovProjectService {
@Override
public List<ProjectDistributionResultDTO> queryProjectDistribution(ProjectDistributionFormDTO formDTO) {
List<ProjectDistributionResultDTO> resultDTOList = new ArrayList<>();
List<IssueInfoDTO> issueInfoDTOList = govIssueService.selectShiftProjectIssueList(formDTO.getCustomerId(), formDTO.getGridId());
List<IssueInfoDTO> issueInfoDTOList = govIssueService.selectShiftProjectIssueList(formDTO.getCustomerId(), formDTO.getGridId(),formDTO.getPageNo(),formDTO.getPageSize());
if (CollectionUtils.isNotEmpty(issueInfoDTOList)) {
List<String> topicIds = issueInfoDTOList.stream().map(data -> data.getTopicId()).collect(Collectors.toList());
// log.info("话题id集合:" + JSON.toJSONString(topicIds, true));

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

@ -1,6 +1,8 @@
package com.epmet.dataaggre.service.resigroup;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.dto.resigroup.form.CandidateListFormDTO;
import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -10,5 +12,12 @@ import java.util.List;
* @DateTime 2020/12/25 上午9:21
*/
public interface ResiGroupService {
List<ResiTopicDTO> selectTopicInfoByIds(@Param("topicIds") List<String> topicIds);
/**
* @Description 可胜任组长-组员列表(工作端通用)
* @Param formDTO
* @author zxc
* @date 2021/3/30 上午9:45
*/
List<CandidateListResultDTO> candidateList(CandidateListFormDTO formDTO);
List<ResiTopicDTO> selectTopicInfoByIds(List<String> topicIds);
}

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

@ -2,14 +2,25 @@ 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.ResiGroupDao;
import com.epmet.dataaggre.dao.resigroup.ResiTopicDao;
import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO;
import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO;
import com.epmet.dataaggre.dto.resigroup.form.CandidateListFormDTO;
import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO;
import com.epmet.dataaggre.redis.ResiGroupRedis;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.resigroup.ResiGroupService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author zxc
@ -21,9 +32,56 @@ import java.util.List;
public class ResiGroupServiceImpl implements ResiGroupService {
@Autowired
private ResiTopicDao resiTopicDao;
@Autowired
private ResiGroupDao resiGroupDao;
@Autowired
private EpmetUserService epmetUserService;
@Autowired
private ResiGroupRedis resiGroupRedis;
@Override
public List<ResiTopicDTO> selectTopicInfoByIds(List<String> topicIds) {
return resiTopicDao.selectTopicInfoByIds(topicIds);
}
/**
* @Description 可胜任组长-组员列表(工作端通用)
* @Param formDTO
* @author zxc
* @date 2021/3/30 上午9:45
*/
@Override
public List<CandidateListResultDTO> candidateList(CandidateListFormDTO formDTO) {
// 根据小组ID查询组员信息身份【不包括组长自己】
PageInfo<CandidateListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> resiGroupDao.candidateList(formDTO.getGroupId()));
List<CandidateListResultDTO> result = pageInfo.getList();
// 没有直接返回空集合
if (CollectionUtils.isEmpty(result)){
return new ArrayList<>();
}
// 获取userIds
List<String> userIds = result.stream().map(m -> m.getUserId()).collect(Collectors.toList());
// 查询用户信息【名字 头像】
List<UserInfosResultDTO> userInfos = epmetUserService.selectUserInfosByUserIds(userIds);
result.forEach(r -> {
if (!CollectionUtils.isEmpty(userInfos)){
userInfos.forEach(u -> {
if (r.getUserId().equals(u.getUserId())){
r.setHeadPhoto(u.getHeadPhoto());
r.setUserShowName(u.getUserShowName());
}
});
}
// 徽章赋值
List<String> badgeInfo = resiGroupRedis.getBadgeInfoByUserId(formDTO.getCustomerId(), r.getUserId());
r.setBadgeList(null==badgeInfo ? new ArrayList<>() : badgeInfo);
});
List<String> showUsers = epmetUserService.selectUserIdByCustomerId(userIds);
if (CollectionUtils.isEmpty(showUsers)){
return new ArrayList<>();
}
List<CandidateListResultDTO> disResult = new ArrayList<>();
showUsers.forEach(u -> result.stream().filter(r -> u.equals(r.getUserId())).forEach(r -> disResult.add(r)));
return disResult;
}
}

5
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml

@ -1,5 +1,6 @@
server:
port: @server.port@
version: @version@
servlet:
context-path: /data/aggregator
@ -126,7 +127,7 @@ feign:
config:
default:
loggerLevel: BASIC
httpclient:
okhttp:
enabled: true
hystrix:
@ -153,4 +154,4 @@ dingTalk:
logging:
level:
com.epmet.dataaggre: debug
com.epmet.dataaggre: debug

34
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml

@ -3,4 +3,38 @@
<mapper namespace="com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao">
<!-- 根据UserIds查询 -->
<select id="selectUserInfosByUserIds" resultType="com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO">
SELECT
user_id,
CONCAT(STREET,'-',SURNAME,
CASE WHEN GENDER = '1' THEN '先生'
WHEN GENDER = '2' THEN '女士'
ELSE '先生/女士' END
) AS userShowName,
HEAD_IMG_URL AS headPhoto
FROM user_base_info
WHERE DEL_FLAG = 0
AND
(
<foreach collection="userIds" item="userId" separator=" OR ">
USER_ID = #{userId}
</foreach>
)
</select>
<!-- 查询客户下是党员/热心居民的userId -->
<select id="selectUserIdByCustomerId" resultType="java.lang.String">
SELECT
DISTINCT(ur.USER_ID) AS userId
FROM epmet_role er
LEFT JOIN user_role ur ON ur.ROLE_ID = er.ID
WHERE ur.DEL_FLAG = 0
AND (er.ROLE_KEY = 'warmhearted' OR er.ROLE_KEY = 'partymember')
AND (
<foreach collection="userIds" item="userId" separator=" OR ">
ur.USER_ID = #{userId}
</foreach>
)
</select>
</mapper>

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

@ -122,6 +122,6 @@
<if test="gridId != null and gridId.trim() != ''">
AND i.GRID_ID = #{gridId}
</if>
order by i.SHIFTED_TIME desc limit 100
order by i.SHIFTED_TIME desc
</select>
</mapper>

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

@ -140,6 +140,5 @@
<foreach item="issueId" collection="list" separator="," open="(" close=")" index="">
#{issueId}
</foreach>
order by CREATED_TIME desc limit 100
</select>
</mapper>

12
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiGroupDao.xml

@ -3,4 +3,16 @@
<mapper namespace="com.epmet.dataaggre.dao.resigroup.ResiGroupDao">
<!-- 根据小组ID查询组员信息身份【不包括组长】 -->
<select id="candidateList" resultType="com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO">
SELECT
rgm.ID AS memberId,
rgm.CUSTOMER_USER_ID AS userId,
rgm.GROUP_LEADER_FLAG AS leaderFlag
FROM resi_group_member rgm
WHERE rgm.DEL_FLAG = '0'
AND rgm.`STATUS` = 'approved'
AND rgm.GROUP_LEADER_FLAG != 'leader'
AND rgm.RESI_GROUP_ID = #{groupId}
</select>
</mapper>

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

@ -17,11 +17,10 @@
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
/**
* 项目(事件)分类按网格_按天统计
@ -67,7 +66,7 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable {
/**
* e世通中的项目类别编码
*/
private String epmetCategoryCode;
private String categoryCode;
/**
* 该分类下所有项目总数
@ -75,39 +74,9 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable {
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
* 分类等级12....
*/
private BigDecimal unResolvedRatio;
private Integer level;
/**
* 删除标识

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

@ -17,11 +17,10 @@
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
/**
* 项目(事件)分类按组织_按天统计
@ -72,7 +71,7 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable {
/**
* e世通中的项目类别编码
*/
private String epmetCategoryCode;
private String categoryCode;
/**
* 该分类下所有项目总数
@ -80,39 +79,9 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable {
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
* 分类等级12....
*/
private BigDecimal unResolvedRatio;
private Integer level;
/**
* 删除标识

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

@ -2,6 +2,7 @@ package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -13,9 +14,26 @@ import java.io.Serializable;
public class ScreenProjectDistributionFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 目前只有平阴在传默认赋值370124
*/
private String areaCode;
/**
* 如果为空返回全部可选值1:红色事件2黄色事件3绿色事件
*/
private String level;
/**
* 当前组织id
*/
@NotBlank(message = "agencyId不能为空")
private String agencyId;
/**
* 不必填默认查询的是处理中可选值all: 全部pending处理中 已结案closed_case 已关闭closed
* 默认查询pending
*/
private String status;
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java

@ -18,7 +18,7 @@ public class VoluntaryServiceTrendFormDTO {
@NotBlank(message = "agencyId不能为空")
private String agencyId;
@NotBlank(message = "目前只有平阴在传,默认赋值:370124")
// @NotBlank(message = "目前只有平阴在传,默认赋值:370124")
private String areaCode;
@NotBlank(message = "customerId不能为空")

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java

@ -36,6 +36,6 @@ public class WorkRecordRankFormDTO implements Serializable {
@NotBlank(message = "customerId不能为空")
private String customerId;
@NotBlank(message = "areaCode不能为空,目前只有平阴在传,默认赋值:370124")
// @NotBlank(message = "areaCode不能为空,目前只有平阴在传,默认赋值:370124")
private String areaCode;
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordTrendResultDTO.java

@ -50,7 +50,7 @@ public class WorkRecordTrendResultDTO implements Serializable {
* 各项资源对应某一月份数据
*/
@JsonIgnore
private Integer value;
private Integer value = 0;
}
}

43
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java

@ -0,0 +1,43 @@
/**
* 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.project.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CustomerCategoryDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 父id
* pid = 0 查询一级分类
* pid != 0 查询二级分类
*/
private String pid;
/**
* 客户Id
*/
private String customerId;
}

41
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.project.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zhangyong
* @Description 002项目分类字典查询
**/
@Data
public class ProjectCategoryDictResultDTO implements Serializable {
private static final long serialVersionUID = 8529179932504931368L;
/**
* 一级分类编码
*/
private String categoryCode;
/**
* 一级分类名称
*/
private String categoryName;
/**
* 二级分类列表
*/
private List<ProjectCategoryDictResultDTO> children;
/**
* 主键
**/
private String id;
/**
* 上级分类ID 顶级此列存储0
**/
private String pid;
}

6
epmet-module/data-report/data-report-server/pom.xml

@ -94,6 +94,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>gov-issue-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java

@ -1,5 +1,6 @@
package com.epmet.datareport.controller.plugins;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService;
@ -50,6 +51,12 @@ public class WorkRecordController {
public Result<WorkRecordTrendResultDTO> trend(@RequestHeader("CustomerId")String customerId, @RequestBody WorkRecordTrendFormDTO formDTO){
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
if(!"party".equals(formDTO.getDataType())&&!"union".equals(formDTO.getDataType())){
throw new RenException("入参dataType值错误,可选值:party--支部建设; union--联建共建");
}
if(!"organize".equals(formDTO.getType())&&!"joinuser".equals(formDTO.getType())&&!"avguser".equals(formDTO.getType())){
throw new RenException("入参type值错误,可选值:组织次数--organize;参与人数--joinuser;平均参与人数--avguser");
}
return new Result<WorkRecordTrendResultDTO>().ok(screenWorkRecordOrgDailyService.trend(formDTO));
}

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

@ -5,15 +5,12 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.*;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectGridDailyService;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityGridMonthlyService;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService;
import com.epmet.datareport.service.project.ProjectService;
import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.screen.EfficiencyAnalysisFormDTO;
import com.epmet.dto.form.screen.QueryQuantityMonthlyFormDTO;
import com.epmet.dto.form.screen.ScreenCommonFormDTO;
import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO;
import com.epmet.dto.result.screen.ProjectQuantityResultDTO;
import com.epmet.dto.result.screen.QueryQuantityMonthlyResultDTO;
import com.epmet.project.constant.ProjectConstant;
import com.epmet.project.dto.form.DifficultyRankFormDTO;
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO;
@ -131,41 +128,16 @@ public class ProjectController {
}
/**
* 002项目分类字典查询
* 查询当前客户的父客户下项目分类字典
*
* @param customerId
* @param formDTO
* @description 事件分析数量统计查询 平阴大屏
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.project.dto.result.ProjectCategoryDictResultDTO>>
* @Author zhangyong
* @Date 10:41 2021-03-22
**/
@PostMapping("queryquantity")
public Result<ProjectQuantityResultDTO> queryQuantity(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCommonFormDTO formDTO){
formDTO.setCustomerId(customerId);
return new Result().ok(projectOrgDailyService.queryQuantity(formDTO));
@PostMapping("categorydict")
public Result<List<ProjectCategoryDictResultDTO>> categoryDict(@RequestHeader("CustomerId") String customerId) {
return new Result<List<ProjectCategoryDictResultDTO>>().ok(projectService.getCategoryDict(customerId));
}
/**
* @param customerId
* @param formDTO
* @author yinzuomei
* @description 近12个月事件分析月度数量分析 平阴大屏
**/
@PostMapping("queryquantity-monthly")
public Result<QueryQuantityMonthlyResultDTO> queryQuantityMonthly(@RequestHeader("CustomerId") String customerId, @RequestBody QueryQuantityMonthlyFormDTO formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
return new Result<QueryQuantityMonthlyResultDTO>().ok(projectQuantityOrgMonthlyService.queryQuantityMonthly(formDTO));
}
/**
* @param customerId
* @param formDTO
* @author yinzuomei
* @description 事件分析效率分析 平阴大屏
**/
@PostMapping("efficiency-analysis")
public Result<List<EfficiencyAnalysisResultDTO>> efficiencyAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody EfficiencyAnalysisFormDTO formDTO){
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO);
return new Result<List<EfficiencyAnalysisResultDTO>>().ok(projectOrgDailyService.efficiencyAnalysis(formDTO));
}
//todo 【事件类型分析】NEI接口地址: https://nei.netease.com/interface/detail/?pid=57068&id=346721
}

49
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java

@ -18,7 +18,6 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -62,37 +61,26 @@ public class ScreenProjectController {
*/
@PostMapping("projectdistribution")
public Result projectDistribution(@RequestBody ScreenProjectDistributionFormDTO formDTO){
if (StringUtils.isBlank(formDTO.getAreaCode()) && StringUtils.isBlank(formDTO.getAgencyId())){
formDTO.setAreaCode("370124");
}
ValidatorUtils.validateEntity(formDTO);
return screenProjectService.projectDistribution(formDTO);
}
@PostMapping("projectdetailv2")
public Result projectDetail(@RequestBody ScreenProjectDetailFormDTO formDTO){
return screenProjectService.projectDistributionDetail(formDTO);
}
/**
* 事件分析类型分析
* @author zhaoqifeng
* @date 2021/2/23 15:37
* @param customerId
* @Description 中央区事件分析-项目详情接口
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.screen.CategoryAnalysisResultDTO>>
* @return com.epmet.commons.tools.utils.Result
* @Author liushaowen
* @Date 2021/2/24 16:10
*/
@PostMapping("category-analysis")
public Result<List<CategoryAnalysisResultDTO>> categoryAnalysis(@RequestHeader("CustomerId") String customerId,
@RequestBody CategoryAnalysisFormDTO formDTO) {
log.info("===================customerId"+customerId);
ValidatorUtils.validateEntity(formDTO, CategoryAnalysisFormDTO.CategoryAnalysis.class);
return new Result<List<CategoryAnalysisResultDTO>>().ok(screenProjectService.categoryAnalysis(customerId, formDTO));
@PostMapping("projectdetailv2")
public Result projectDetail(@RequestBody ScreenProjectDetailFormDTO formDTO){
return screenProjectService.projectDistributionDetail(formDTO);
}
/**
* @param customerId
* @param formDTO
* @description 事件分析数量统计查询 平阴大屏
* @description 1事件分析数量统计查询 平阴大屏
**/
@PostMapping("queryquantity")
public Result<ProjectQuantityResultDTO> queryQuantity(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCommonFormDTO formDTO){
@ -104,7 +92,7 @@ public class ScreenProjectController {
* @param customerId
* @param formDTO
* @author yinzuomei
* @description 近12个月事件分析月度数量分析 平阴大屏
* @description 2近12个月事件分析月度数量分析 平阴大屏
**/
@PostMapping("queryquantity-monthly")
public Result<QueryQuantityMonthlyResultDTO> queryQuantityMonthly(@RequestHeader("CustomerId") String customerId, @RequestBody QueryQuantityMonthlyFormDTO formDTO) {
@ -117,7 +105,7 @@ public class ScreenProjectController {
* @param customerId
* @param formDTO
* @author yinzuomei
* @description 事件分析效率分析 平阴大屏
* @description 3事件分析效率分析 平阴大屏
**/
@PostMapping("efficiency-analysis")
public Result<List<EfficiencyAnalysisResultDTO>> efficiencyAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody EfficiencyAnalysisFormDTO formDTO){
@ -126,4 +114,19 @@ public class ScreenProjectController {
return new Result<List<EfficiencyAnalysisResultDTO>>().ok(projectOrgDailyService.efficiencyAnalysis(formDTO));
}
/**
* 事件分析类型分析
* @author zhaoqifeng
* @date 2021/2/23 15:37
* @param customerId
* @param formDTO 事件类型分析NEI接口地址 https://nei.netease.com/interface/detail/?pid=57068&id=346721
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.screen.CategoryAnalysisResultDTO>>
*/
@PostMapping("category-analysis")
public Result<List<CategoryAnalysisResultDTO>> categoryAnalysis(@RequestHeader("CustomerId") String customerId,
@RequestBody CategoryAnalysisFormDTO formDTO) {
log.info("===================customerId"+customerId);
ValidatorUtils.validateEntity(formDTO, CategoryAnalysisFormDTO.CategoryAnalysis.class);
return new Result<List<CategoryAnalysisResultDTO>>().ok(screenProjectService.categoryAnalysis(customerId, formDTO));
}
}

14
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java

@ -1,5 +1,7 @@
package com.epmet.datareport.controller.user;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.user.UserIncrTrendFormDTO;
@ -50,9 +52,9 @@ public class UserAnalysisController {
* @Date 2020/6/22 13:30
**/
@PostMapping("subagency")
public Result<List<UserSubAgencyResultDTO>> subAgency(@RequestBody UserSubAgencyFormDTO formDTO) {
public Result<List<UserSubAgencyResultDTO>> subAgency(@LoginUser TokenDto tokenDto, @RequestBody UserSubAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,UserSubAgencyFormDTO.AddUserInternalGroup.class);
List<UserSubAgencyResultDTO> userSubAgencyResultDTO = userService.subAgency(formDTO);
List<UserSubAgencyResultDTO> userSubAgencyResultDTO = userService.subAgency(tokenDto, formDTO);
return new Result<List<UserSubAgencyResultDTO>>().ok(userSubAgencyResultDTO);
}
@ -64,9 +66,9 @@ public class UserAnalysisController {
* @Date 2020/6/22 13:33
**/
@PostMapping("subgrid")
public Result<List<UserSubGridResultDTO>> subGrid(@RequestBody UserSubGridFormDTO formDTO) {
public Result<List<UserSubGridResultDTO>> subGrid(@LoginUser TokenDto tokenDto, @RequestBody UserSubGridFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UserSubGridFormDTO.AddUserInternalGroup.class);
List<UserSubGridResultDTO> userSubGridResultDTO = userService.subGrid(formDTO);
List<UserSubGridResultDTO> userSubGridResultDTO = userService.subGrid(tokenDto, formDTO);
return new Result<List<UserSubGridResultDTO>>().ok(userSubGridResultDTO);
}
@ -78,9 +80,9 @@ public class UserAnalysisController {
* @Date 2020/6/22 13:36
**/
@PostMapping("incrtrend")
public Result<List<UserIncrTrendResultDTO>> incrTrend(@RequestBody UserIncrTrendFormDTO formDTO) {
public Result<List<UserIncrTrendResultDTO>> incrTrend(@LoginUser TokenDto tokenDto, @RequestBody UserIncrTrendFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UserIncrTrendFormDTO.AddUserInternalGroup.class);
List<UserIncrTrendResultDTO> userIncrTrendResultDTO = userService.incrTrendV2(formDTO);
List<UserIncrTrendResultDTO> userIncrTrendResultDTO = userService.incrTrendV2(tokenDto, formDTO);
return new Result<List<UserIncrTrendResultDTO>>().ok(userIncrTrendResultDTO);
}

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

@ -10,7 +10,10 @@ import java.util.List;
@Mapper
public interface ScreenProjectDataDao {
List<ScreenProjectDistributionResultDTO> projectDistribution(@Param("agencyId") String agencyId, @Param("ids") List<String> ids, @Param("level") String level);
List<ScreenProjectDistributionResultDTO> projectDistribution(@Param("agencyId") String agencyId,
@Param("ids") List<String> ids,
@Param("level") String level,
@Param("status")String status);
List<String> selectIdsByAreaCode(@Param("areaCode") String areaCode);

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

@ -39,5 +39,9 @@ public interface ScreenProjectGridDailyDao{
* @author yinzuomei
* @description 下级网格的效率解决率列表
**/
List<EfficiencyAnalysisResultDTO> queryGridEfficiencyAnalysis(@Param("customerId") String customerId, @Param("areaCode") String areaCode);
List<EfficiencyAnalysisResultDTO> queryGridEfficiencyAnalysis(@Param("customerId") String customerId,
@Param("areaCode") String areaCode,
@Param("dateId")String dateId);
String selectLastDateId(String customerId);
}

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

@ -17,7 +17,10 @@
package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.alibaba.druid.util.StringUtils;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectGridDailyDao;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectGridDailyService;
@ -48,6 +51,12 @@ public class ScreenProjectGridDailyServiceImpl implements ScreenProjectGridDail
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
public List<EfficiencyAnalysisResultDTO> efficiencyAnalysis(String customerId, String areaCode) {
return screenProjectGridDailyDao.queryGridEfficiencyAnalysis(customerId,areaCode);
//先查询最后一次统计的dateId
String dateId=screenProjectGridDailyDao.selectLastDateId(customerId);
if(StringUtils.isEmpty(dateId)){
//如果为空,默认查询前一天
dateId= DateUtils.getBeforeNDay(NumConstant.ONE);
}
return screenProjectGridDailyDao.queryGridEfficiencyAnalysis(customerId,areaCode,dateId);
}
}

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

@ -66,7 +66,7 @@ public class ScreenProjectOrgDailyServiceImpl implements ScreenProjectOrgDailySe
if (null != resultDTO) {
return resultDTO;
}
log.warn("【事件分析】数量统计查询 结果为空");
log.warn(String.format("【事件分析】数量统计查询 结果为空,customerId:%s,agencyId:%s",formDTO.getCustomerId(),formDTO.getAgencyId()));
ProjectQuantityResultDTO defaultDto = new ProjectQuantityResultDTO();
defaultDto.setCustomerId(formDTO.getCustomerId());
defaultDto.setAgencyId(formDTO.getAgencyId());

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

Loading…
Cancel
Save