Browse Source

Merge branch 'dev' into dev_mq_init_customer

master
wxz 4 years ago
parent
commit
e99c031a19
  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. 28
      epmet-auth/src/main/java/com/epmet/controller/SsoController.java
  18. 6
      epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java
  19. 6
      epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginFormDTO.java
  20. 32
      epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java
  21. 42
      epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java
  22. 57
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdPlatFormDTO.java
  23. 1
      epmet-auth/src/main/java/com/epmet/dto/result/UserTokenResultDTO.java
  24. 50
      epmet-auth/src/main/java/com/epmet/enums/ThirdPlatformEnum.java
  25. 18
      epmet-auth/src/main/java/com/epmet/service/SsoService.java
  26. 8
      epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java
  27. 2
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  28. 8
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  29. 6
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  30. 121
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  31. 2
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  32. 28
      epmet-auth/src/main/resources/bootstrap.yml
  33. 2
      epmet-auth/src/main/resources/logback-spring.xml
  34. 2
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java
  35. 11
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java
  36. 64
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java
  37. 128
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java
  38. 1
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/bean/ThirdPlatUserInfo.java
  39. 18
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/PyldConstants.java
  40. 2
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java
  41. 25
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java
  42. 18
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/PyldUserInfoResultDTO.java
  43. 14
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/PyldThirdplatProps.java
  44. 11
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java
  45. 5
      epmet-commons/epmet-commons-tools/pom.xml
  46. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java
  47. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  48. 84
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java
  49. 109
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java
  50. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  51. 67
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java
  52. 121
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java
  53. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java
  54. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  55. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  56. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java
  57. 17
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java
  58. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  59. 153
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  60. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java
  61. 135
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
  62. 43
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java
  63. 49
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  64. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java
  65. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  66. 15
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  67. 251
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java
  68. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/IdCardNoValidatorUtils.java
  69. 8
      epmet-gateway/src/main/resources/bootstrap.yml
  70. 13
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java
  71. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java
  72. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java
  73. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java
  74. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java
  75. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
  76. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml
  77. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml
  78. 20
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java
  79. 142
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java
  80. 147
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java
  81. 21
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/CategoryAnalysisFormDTO.java
  82. 26
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java
  83. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyAndNumFormDTO.java
  84. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyNumTypeParamFormDTO.java
  85. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ContactMassLineChartFormDTO.java
  86. 1
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java
  87. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ParymemberFormDTO.java
  88. 19
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDetailFormDTO.java
  89. 39
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDistributionFormDTO.java
  90. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java
  91. 42
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankPyFormDTO.java
  92. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/GovernCapacityResultDTO.java
  93. 124
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java
  94. 32
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDistributionResultDTO.java
  95. 31
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java
  96. 3
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java
  97. 46
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java
  98. 30
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java
  99. 23
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java
  100. 7
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.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);
}
}
/**

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

@ -6,6 +6,8 @@ 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;
import com.epmet.service.SsoService;
@ -30,22 +32,34 @@ public class SsoController {
private JcetApiService jcetApiService;
/**
* @Description 0入口得到token
* @Description 0泸州app登陆入口得到token
* @Param formDTO
* @author zxc
* @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));
}
/**
* @Description 0第三方系统跳转至 运营平台登陆接口
* @Param formDTO
* @author zxc
* @date 2021/1/18 下午4:59
*/
@PostMapping("oper/third/login")
public Result<UserTokenResultDTO> thirdLoginOper(@RequestBody SsoLoginOperFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SsoLoginOperFormDTO.ThirdPlatformLoginForm.class);
return new Result<UserTokenResultDTO>().ok(ssoService.thirdLoginOperWork(formDTO));
}
@PostMapping("test")
public Result<ThirdPlatUserInfo> testssoLogin(){
public Result<ThirdPlatUserInfo> testssoLogin() {
ThirdPlatUserInfo userInfoByTicket = null;
try {
userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
userInfoByTicket = jcetApiService.getCUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui");
} catch (Exception e) {
e.printStackTrace();
}
@ -58,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;
/**
* 手机号

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

@ -19,7 +19,7 @@ public class SsoLoginFormDTO implements Serializable {
/**
* sso票据有效期为300秒
*/
@NotBlank(message = "sso票据不能为空",groups = SsoLoginForm.class)
@NotBlank(message = "sso票据不能为空", groups = {SsoLoginForm.class})
private String ticket;
/**
@ -31,12 +31,12 @@ public class SsoLoginFormDTO implements Serializable {
/**
* app类型 resi居民段gov工作端
*/
@NotBlank(message = "app不能为空",groups = SsoLoginForm.class)
@NotBlank(message = "app不能为空", groups = SsoLoginForm.class)
private String app;
/**
* app居民段app工作端
*/
@NotBlank(message = "client不能为空",groups = SsoLoginForm.class)
@NotBlank(message = "client不能为空", groups = SsoLoginForm.class)
private String client;
}

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

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

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;
}

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

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

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

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

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

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

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

@ -2,6 +2,8 @@ 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;
@ -12,19 +14,19 @@ import com.epmet.dto.result.UserTokenResultDTO;
public interface SsoService {
/**
* @Description 0入口得到token
* @Description 0入口得到token
* @Param formDTO
* @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
@ -32,4 +34,14 @@ public interface SsoService {
* @Description 4自动进入组织-返回token
**/
UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO);
/**
* desc: sso登陆运营端
*
* @param formDTO
* @return com.epmet.dto.result.UserTokenResultDTO
* @author LiuJanJun
* @date 2021/2/24 1:28 下午
*/
UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO 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);
}

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

@ -362,7 +362,7 @@ public class GovLoginServiceImpl implements GovLoginService {
}
//密码错误
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();

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

@ -10,10 +10,7 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.GovWebLoginFormDTO;
import com.epmet.dto.form.GovWebOperLoginFormDTO;
import com.epmet.dto.form.LoginByPassWordFormDTO;
import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.result.GovWebOperLoginResultDTO;
import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.jwt.JwtTokenProperties;
@ -65,7 +62,7 @@ public class GovWebServiceImpl implements GovWebService {
//2.验证码校验
boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha());
if (!flag) {
logger.error(String.format("用户%s登录,验证码输入错误,暂时放行", formDTO.getPhone()));
logger.warn(String.format("用户%s登录,验证码输入错误", formDTO.getPhone()));
//开启验证码校验
throw new RenException(EpmetErrorCode.ERR10019.getCode());
}
@ -84,7 +81,7 @@ public class GovWebServiceImpl implements GovWebService {
//4.密码是否正确
//密码错误
if (!PasswordUtils.matches(formDTO.getPassword(), resultDTO.getPassWord())) {
logger.error("登陆密码错误");
logger.warn("登陆密码错误");
throw new RenException(EpmetErrorCode.ERR10004.getCode());
}
@ -109,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);

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

@ -293,9 +293,9 @@ public class LoginServiceImpl implements LoginService {
//1、验证码是否正确
boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha());
if (!flag) {
logger.error(String.format("用户%s登录,验证码输入错误,暂时放行",formDTO.getPhone()));
//2020-05-21去除验证码校验 TODO
//return new Result<UserTokenResultDTO>().error(EpmetErrorCode.ERR10019.getCode());
logger.warn(String.format("用户%s登录,验证码输入错误", formDTO.getPhone()));
//2020-05-21去除验证码校验
return new Result<UserTokenResultDTO>().error(EpmetErrorCode.ERR10019.getCode());
}
//2、账号是否存在
//获取用户信息

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

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.thirdplat.apiservice.AbstractApiService;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import com.epmet.commons.thirdplat.constants.PyldConstants;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
@ -14,6 +15,8 @@ import com.epmet.commons.tools.utils.*;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.enums.ThirdPlatformEnum;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
@ -22,13 +25,16 @@ import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.SsoRedis;
import com.epmet.service.SsoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -66,15 +72,22 @@ public class SsoServiceImpl implements SsoService {
@Autowired
private CpUserDetailRedis cpUserDetailRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Value("${epmet.third.urlPrefix}")
private String epmetThirdUrlPrefix;
/**
* @Description 0入口得到token
* @Description 0入口得到token
* @Param formDTO
* @author zxc
* @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));
@ -89,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());
}
@ -114,18 +127,66 @@ public class SsoServiceImpl implements SsoService {
throw new RenException("【SSO登录】userId为空,生成token失败");
}
//生成业务token
String token = this.generateToken(formDTO.getApp(),formDTO.getClient(), userId);
String token = this.generateToken(formDTO.getApp(), formDTO.getClient(), userId);
//存放Redis
if (StringUtils.isBlank(customerId)){
if (StringUtils.isBlank(customerId)) {
throw new RenException("【SSO登录】customerId为空,缓存放置token失败");
}
this.disposeTokenDto(formDTO, userId, token, customerId);
this.disposeTokenDto(formDTO.getApp(), formDTO.getClient(), userId, token, customerId);
return new SsoLoginResultDTO(token);
}
@Override
public UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO formDTO) {
ThirdPlatUserInfo thirdUser;
try {
ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform());
String apiService = platformEnum.getApiService();
AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService);
thirdUser = apiServiceImpl.getGUserInfoBySSOToken(formDTO.getThirdToken());
} catch (RenException e) {
throw new RenException(e.getCode(), e.getMessage());
} catch (Exception e) {
throw new RenException(e.getMessage());
}
if (thirdUser == null) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), PyldConstants.REPONSE_USER_NOT_LOGIN);
}
//获取用户信息
GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO();
form.setCustomerId(thirdUser.getCustomerId());
form.setMobile(thirdUser.getMobile());
Result<GovWebOperLoginResultDTO> result = epmetUserFeignClient.getStaffIdAndPwd(form);
//todo userId 写死测试 3f7f852ce22c511aa67ecb695395295d start
/* GovWebOperLoginResultDTO demo = new GovWebOperLoginResultDTO();
demo.setUserId("3f7f852ce22c511aa67ecb695395295d");
result = new Result<>();
result.ok(demo);*/
//test end
if (!result.success() || null == result.getData() || null == result.getData().getUserId()) {
logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在,param:{}", JSON.toJSONString(form));
throw new RenException(EpmetErrorCode.ERR10003.getCode());
}
//4、生成token返回,且将TokenDto存到redis
//生成业务token
GovWebOperLoginResultDTO epmetUser = result.getData();
String token = this.generateToken(formDTO.getApp(), formDTO.getClient(), epmetUser.getUserId());
//存放Redis
this.disposeTokenDto(formDTO.getApp(), formDTO.getClient(), epmetUser.getUserId(), token, thirdUser.getCustomerId());
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
userTokenResultDTO.setCustomerId(thirdUser.getCustomerId());
return userTokenResultDTO;
}
/**
* @Description token放缓存
* @Description token放缓存
* @Param formDTO
* @Param userId
* @Param token
@ -133,12 +194,12 @@ public class SsoServiceImpl implements SsoService {
* @author zxc
* @date 2021/1/18 下午5:32
*/
public void disposeTokenDto(SsoLoginFormDTO formDTO, String userId, String token, String customerId){
public void disposeTokenDto(String app, String client, String userId, String token, String customerId) {
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
tokenDto.setCustomerId(customerId);
tokenDto.setApp(formDTO.getApp());
tokenDto.setClient(formDTO.getClient());
tokenDto.setApp(app);
tokenDto.setClient(client);
tokenDto.setUserId(userId);
tokenDto.setToken(token);
tokenDto.setUpdateTime(System.currentTimeMillis());
@ -155,7 +216,7 @@ public class SsoServiceImpl implements SsoService {
* @author zxc
* @date 2021/1/18 下午5:14
*/
private String generateToken(String app,String client, String userId) {
private String generateToken(String app, String client, String userId) {
Map<String, Object> map = new HashMap<>(16);
map.put("app", app);
map.put("client", client);
@ -173,7 +234,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);
@ -199,10 +260,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));
@ -215,7 +277,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());
}
@ -297,7 +359,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("");
@ -423,21 +485,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,并记录用户激活状态,激活时间
@ -466,4 +528,25 @@ public class SsoServiceImpl implements SsoService {
return userTokenResultDTO;
}
public static void main(String[] args) {
String url = "https://epmet-ext9.elinkservice.cn/platform/unifiedAuth/loginCheck";
String platformToken = "1348803062424166401_dd08e23b0d524879a5c67e7f2ffd1468";
String appId = "7a5aec009ba4eba8e254ee64fe3775e1";
String appKey = "14faef9af508d1c253b720ea5a43f9de";
String appSecret = "38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595";
long ts = System.currentTimeMillis();
String message = appId + appKey + appSecret + ts;
String accessToken = DigestUtils.md5Hex(message.getBytes(StandardCharsets.UTF_8));
//ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum("pyld");
JSONObject jsonObject = new JSONObject();
jsonObject.put("platformToken", platformToken);
Map<String, Object> headerMap = new HashMap<>(4);
headerMap.put("AppKey", appKey);
headerMap.put("Timestamp", ts);
headerMap.put("AccessToken", accessToken);
Result<String> stringResult = HttpClientManager.getInstance().sendPost(url, url.startsWith("https://"), jsonObject.toJSONString(), headerMap);
System.out.println(stringResult);
}
}

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

@ -484,7 +484,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService {
}
//密码错误
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();

28
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,7 +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-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;

11
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 解析请求结果
@ -32,7 +40,6 @@ public abstract class AbstractApiService {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),
EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(thResult.getInternalMsg()));
}
JcetResult jcetResult = JSON.parseObject(thResult.getData(), JcetResult.class);
if (!jcetResult.isSuccess()) {
throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(),

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;
@ -13,6 +14,7 @@ import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
@ -22,11 +24,13 @@ 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();
}
/**
@ -35,7 +39,7 @@ public class JcetApiService extends AbstractApiService {
* @author wxz
* @date 2021.01.19 10:26
*/
public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket);
@ -43,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());
@ -57,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());
@ -66,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获取用户信息
@ -94,19 +130,17 @@ public class JcetApiService extends AbstractApiService {
/**
* 获取请求所需要的头信息
*
* @param contentObject
* @return
* @throws UnsupportedEncodingException
*/
private Map<String, String> getHeaders(Object contentObject) throws UnsupportedEncodingException {
int bodyLength = JSON.toJSONString(contentObject).getBytes("utf-8").length;
private Map<String, Object> getHeaders(int bodyLength, String appKey, String appSecret) throws UnsupportedEncodingException {
Map<String, String> headers = new HashMap();
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;
}

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

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

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

@ -7,4 +7,5 @@ public class ThirdPlatUserInfo {
private String openId;
private String name;
private String mobile;
private String customerId;
}

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

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

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;
}

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

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

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

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

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

@ -7,6 +7,15 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(prefix = "thirdplat")
public class ThirdplatProps {
private JcetThirdplatProps jcet;
// C端
private JcetThirdplatProps jcetCend;
// G端
private JcetThirdplatProps jcetGend;
/**
* 平阴联动指挥平台
*/
private PyldThirdplatProps pyld;
}

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);
}
}
}

3
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);

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);
}
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java

@ -11,9 +11,6 @@ package com.epmet.commons.tools.aspect;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.dto.form.HasSpecifiedPermissionFormDTO;
import com.epmet.commons.tools.dto.form.LoginUserInfoFormDTO;
import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO;
import com.epmet.commons.tools.dto.form.RoleOpeScopeResultDTO;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
@ -30,11 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 每次请求过滤Api中配置的权限key出来并且判断是否具有该功能权限
* @Author wxz
@ -89,8 +81,9 @@ public class RequirePermissionAspect {
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
Boolean data = result.getData();
if (data == null || !data) {
log.error("操作权限不足");
log.warn("操作权限不足,key:{}", requirePermission);
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode());
}
}

1
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;

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();
}

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

@ -11,11 +11,14 @@ import org.springframework.core.env.Environment;
* @date 2020-07-03 11:14
**/
public enum EnvEnum {
LOCAL("local", "本地环境","http://localhost:8080/api/"),
DEV("dev", "开发环境","http://192.168.1.130:8080/api/"),
TEST("test", "体验环境","https://epmet-dev.elinkservice.cn/api/"),
PROD("prod", "生产环境","https://epmet-cloud.elinkservice.cn/api/"),
UN_KNOWN("un_known", "未知","https://epmet-dev.elinkservice.cn/api/"),
/**
* 环境变量枚举
*/
LOCAL("local", "本地环境", "http://localhost:8080/api/"),
DEV("dev", "开发环境", "http://192.168.1.130:8080/api/"),
TEST("test", "体验环境", "https://epmet-dev.elinkservice.cn/api/"),
PROD("prod", "生产环境", "https://epmet-cloud.elinkservice.cn/api/"),
UN_KNOWN("un_known", "未知", "https://epmet-dev.elinkservice.cn/api/"),
;
private String code;
@ -33,7 +36,7 @@ public enum EnvEnum {
public static EnvEnum getEnum(String code) {
EnvEnum[] values = EnvEnum.values();
for (EnvEnum value : values) {
if (code != null && value.getCode().equals(code)) {
if (value.getCode().equals(code)) {
return value;
}
}
@ -44,7 +47,7 @@ public enum EnvEnum {
try {
Environment environment = SpringContextUtils.getBean(Environment.class);
String[] activeProfiles = environment.getActiveProfiles();
if (activeProfiles != null && activeProfiles.length > 0) {
if (activeProfiles.length > 0) {
return getEnum(activeProfiles[0]);
}
} catch (Exception e) {

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

@ -125,9 +125,11 @@ 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,"手机号未注册,请先完成信息注册"),

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));
}
}

49
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,46 @@ 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
* @return
* @author wxz
* @date 2021.01.20 16:56
* @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 getCustomerApiServiceKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId);
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);
}
}

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

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

@ -188,15 +188,16 @@ public class HttpClientManager {
}
public Result<String> sendPost(String url, boolean isHttps, String jsonStrParam,Map<String,String> headerMap) {
public Result<String> sendPost(String url, boolean isHttps, String jsonStrParam, Map<String, Object> headerMap) {
try {
HttpPost httppost = new HttpPost(url);
httppost.setConfig(requestConfig);
httppost.addHeader(HEADER_CONTENT_TYPE, HEADER_APPLICATION_JSON);
if (null != headerMap){
headerMap.forEach((k,v) -> {
httppost.addHeader(k,v);
if (null != headerMap) {
headerMap.forEach((k, v) -> {
if (v != null)
httppost.addHeader(k, v.toString());
});
}
if (StringUtils.isNotEmpty(jsonStrParam)) {
@ -348,7 +349,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);
@ -363,7 +364,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);

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");
}
}
}

20
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/IdCardNoValidatorUtils.java

@ -35,14 +35,14 @@ public class IdCardNoValidatorUtils {
try {
//判断号码的长度 15位或18位
if (idCardNo.length() != 15 && idCardNo.length() != 18) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证号码长度应该为15位或18位"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证号码长度应该为15位或18位"));
return false;
}
if (idCardNo.length() == 18) {
String lastStr = idCardNo.substring(idCardNo.length() - 1);
if (!Character.isDigit(lastStr.charAt(0))) {
if (Character.isLowerCase(lastStr.charAt(0))) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "18身份证号最后一位字母需要大写"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "18身份证号最后一位字母需要大写"));
return false;
}
} else {
@ -55,7 +55,7 @@ public class IdCardNoValidatorUtils {
iDCardNo = idCardNo.substring(0, 6) + "19" + idCardNo.substring(6, 15);
}
if (isStrNum(iDCardNo) == false) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证15位号码都应为数字;18位号码除最后一位外,都应为数字"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证15位号码都应为数字;18位号码除最后一位外,都应为数字"));
return false;
}
//判断出生年月
@ -63,27 +63,27 @@ public class IdCardNoValidatorUtils {
String strMonth = iDCardNo.substring(10, 12);// 月份
String strDay = iDCardNo.substring(12, 14);// 月份
if (isStrDate(strYear + "-" + strMonth + "-" + strDay) == false) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日无效"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日无效"));
return false;
}
GregorianCalendar gc = new GregorianCalendar();
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
if ((gc.get(Calendar.YEAR) - Integer.parseInt(strYear)) > 150 || (gc.getTime().getTime() - s.parse(strYear + "-" + strMonth + "-" + strDay).getTime()) < 0) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日不在有效范围"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日不在有效范围"));
return false;
}
if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证月份无效"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证月份无效"));
return false;
}
if (Integer.parseInt(strDay) > 31 || Integer.parseInt(strDay) == 0) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证日期无效"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证日期无效"));
return false;
}
//判断地区码
Hashtable h = GetAreaCode();
if (h.get(iDCardNo.substring(0, 2)) == null) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证地区编码错误"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证地区编码错误"));
return false;
}
//判断最后一位
@ -96,12 +96,12 @@ public class IdCardNoValidatorUtils {
iDCardNo = iDCardNo + strVerifyCode;
if (idCardNo.length() == 18 && !iDCardNo.equals(idCardNo)) {
logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证无效,不是合法的身份证号码"));
logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证无效,不是合法的身份证号码"));
return false;
}
} catch (Exception e) {
logger.error(String.format("校验身份证号方法异常"));
logger.warn(String.format("校验身份证号方法异常"));
e.printStackTrace();
}
return true;

8
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,6 +457,11 @@ epmet:
- /gov/project/**
- /resi/home/**
- /data/report/**
- /epmet/ext/**
- /data/stats/**
- /data/aggregator/**
- /gov/voice/**
- /resi/voice/**
# 内部认证url白名单(在白名单中的,就不会再校验登录了)
internalAuthUrlsWhiteList:

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;
}

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));

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

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

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

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>

20
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 17:52
*/
@Data
public class AgencyInfoDTO implements Serializable {
private String agencyId;
private String areaCode;
private List<String> subAgencyIds;
private List<String> subGridIds;
}

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

@ -0,0 +1,142 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 项目(事件)分类按网格_按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-02-23
*/
@Data
public class ScreenProjectCategoryGridDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 日期yyyyMMdd
*/
private String dateId;
/**
* 网格id
*/
private String gridId;
/**
* 网格所属的组织id
*/
private String pid;
/**
* 网格所有的父级id,以英文:或者英文,隔开
*/
private String pids;
/**
* e世通中的项目类别编码
*/
private String epmetCategoryCode;
/**
* 该分类下所有项目总数
*/
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
*/
private BigDecimal unResolvedRatio;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

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

@ -0,0 +1,147 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 项目(事件)分类按组织_按天统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-02-23
*/
@Data
public class ScreenProjectCategoryOrgDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 日期yyyyMMdd
*/
private String dateId;
/**
* 组织id
*/
private String orgId;
/**
* 社区级community街道:street,区县级: district,市级: city省级:province
*/
private String orgType;
/**
* 当前orgId所属的上级id
*/
private String pid;
/**
* orgId所有的父级id,以英文:或者英文,隔开
*/
private String pids;
/**
* e世通中的项目类别编码
*/
private String epmetCategoryCode;
/**
* 该分类下所有项目总数
*/
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
*/
private BigDecimal unResolvedRatio;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

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

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

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

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

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

@ -25,4 +25,9 @@ public class AgencyAndNumFormDTO implements Serializable {
* */
@NotBlank(message = "机关Id不能为空" , groups = AgencyFormDTO.CommonAgencyIdGroup.class)
private String agencyId;
/**
* 目前只有平阴在传默认赋值370124
*/
private String areaCode;
}

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

@ -32,4 +32,9 @@ public class AgencyNumTypeParamFormDTO implements Serializable {
@NotBlank(message = "类型不能为空", groups = AgencyNumTypeParamGroup.class)
private String type;
/**
* 地区编码
*/
private String areaCode;
}

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

@ -21,4 +21,9 @@ public class ContactMassLineChartFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {ContactMassLineChart.class})
private String agencyId;
/**
* 目前只有平阴在传默认赋值370124
*/
private String areaCode;
}

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

@ -3,6 +3,7 @@ package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**

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

@ -21,4 +21,9 @@ public class ParymemberFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {Parymember.class})
private String agencyId;
/**
* 目前只有平阴在传默认赋值370124
*/
private String areaCode;
}

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

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

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

@ -0,0 +1,39 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @description:
* @author: liushaowen
* @date: 2021/2/24 15:22
*/
@Data
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;
}

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

@ -35,4 +35,9 @@ public class SubAgencyIndexRankFormDTO implements Serializable {
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
/**
* 行政区域编码
*/
private String areaCode;
}

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

@ -0,0 +1,42 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/28 14:29
*/
@Data
public class SubAgencyIndexRankPyFormDTO implements Serializable {
private static final long serialVersionUID = 8930332375421099186L;
/**
* 当前组织平阴大屏默认传跟组织
* */
@NotBlank(message = "agencyId不能为空")
private String agencyId;
/**
* 目前只有平阴在传默认赋值370124
* */
@NotBlank(message = "areaCode不能为空;平阴默认传:370124")
private String areaCode;
/**
* 默认查询前10条
* */
@NotNull(message = "topNum不能为空")
private Integer topNum;
@NotBlank(message = "type不能为空,街道:street;网格:grid")
private String type;
@NotBlank(message = "customerId不能为空")
private String customerId;
}

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

@ -44,4 +44,6 @@ public class GovernCapacityResultDTO implements Serializable {
* 当前agencyName的上一级组织名称
*/
private String parentAgencyName;
private String orgId;
}

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

@ -0,0 +1,124 @@
package com.epmet.evaluationindex.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: liushaowen
* @date: 2021/2/24 16:15
*/
@Data
public class ScreenProjectDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 项目id
*/
private String projectId;
/**
* 议题内容其实就是项目内容
*/
private String projectContent;
/**
* 上报时间对应的是立项时间;格式yyyy-MM-dd HH:mm
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private String reportTime;
/**
* 所属类别名称
*/
private String categoryName;
/**
* 上报人名
*/
private String reportUserName;
/**
* 上报人电话
*/
private String mobile;
/**
* 上报位置
*/
private String reportAddress;
/**
* 图片列表
*/
private List<String> imgList;
/**
* 处理进展列表(返回的是按时间升序的集合)
*/
private List<processDTO> processList;
@Data
public static class processDTO{
@JsonIgnore
private String processId;
/**
* 处理部门名称
*/
private String handleDeptName;
/**
* 公开处理意见
*/
private String suggestion;
/**
* 处理时间yyyy-MM-dd HH:mm:ss
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reponseTime;
/**
* 关闭close; 回应 response结案closed_case退回return部门流转transfer创建项目created
*/
private String operation;
/**
* 被吹哨部门如果是多个以逗号隔开返给前端
*/
private String whistleDeptName;
private List<AttachmentDTO> attachments;
@Data
public static class AttachmentDTO{
@JsonInclude(JsonInclude.Include.NON_NULL)
/**
* 文件名
*/
private String fileName;
@JsonInclude(JsonInclude.Include.NON_NULL)
/**
* 附件名uuid随机生成
*/
private String attachmentName;
@JsonInclude(JsonInclude.Include.NON_NULL)
/**
* 附件大小 字节为单位
*/
private String attachmentSize;
@JsonInclude(JsonInclude.Include.NON_NULL)
/**
* 文件格式JPGPNGJPEGBMPGIFPDFPPTPPTXDOCDOCXXLSXLSXMP3WMAM4AMP4AVIMOVRMVBRMWMV
*/
private String attachmentFormat;
@JsonInclude(JsonInclude.Include.NON_NULL)
/**
* 文件类型图片 - image 视频 - video 语音 - voice 文档 - doc
*/
private String attachmentType;
/**
* url地址
*/
private String attachmentUrl;
@JsonInclude(JsonInclude.Include.NON_NULL)
/**
* 语音或视频时长
*/
private String duration;
}
}
}

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

@ -0,0 +1,32 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @description:
* @author: liushaowen
* @date: 2021/2/24 15:26
*/
@Data
public class ScreenProjectDistributionResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private String id;
/**
* 项目标题
*/
private String projectTitle;
/**
* 项目等级 1:红色事件2黄色事件3绿色事件
*/
private String level;
/**
* 经纬度
*/
private String longitude;
private String latitude;
}

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

@ -0,0 +1,31 @@
package com.epmet.plugins.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 19:53
*/
@Data
public class VoluntaryServiceTrendFormDTO {
/**
* 当前组织id
*/
@NotBlank(message = "agencyId不能为空")
private String agencyId;
@NotBlank(message = "目前只有平阴在传,默认赋值:370124")
private String areaCode;
@NotBlank(message = "customerId不能为空")
private String customerId;
/**
* 截止到某月格式yyyyMM目前没有让大屏前端赋值代码默认为为上个月
*/
private String endMonthId;
}

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

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

46
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java

@ -0,0 +1,46 @@
package com.epmet.plugins.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 6工作日志近12月趋势图
*
* @author sun
*/
@Data
public class WorkRecordTrendFormDTO implements Serializable {
private static final long serialVersionUID = -2934835714413031036L;
/**
* party:支部建设; union:联建共建党员志愿服务voluntaryservice
*/
@NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建")
private String dataType;
/**
* 当前组织id
*/
@NotBlank(message = "agencyId不能为空")
private String agencyId;
/**
* 组织次数organize参与人数joinuser平均参与人数avguser
*/
@NotBlank(message = "type不能为空")
private String type;
@NotBlank(message = "customerId不能为空")
private String customerId;
/**
* 查询数据起始月份Id
*/
private String startMonth;
/**
* 查询数据结束月份Id
*/
private String endMonth;
}

30
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java

@ -0,0 +1,30 @@
package com.epmet.plugins.result;
import lombok.Data;
import java.io.Serializable;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/28 13:41
*/
@Data
public class VoluntaryServiceTrendDTO implements Serializable {
private String monthId;
/**
* 组织次数
*/
private Integer organizeTotal;
/**
* 参与人数
*/
private Integer participateUserTotal;
/**
* 平均参与人数
*/
private Integer avgParticipateUserTotal;
}

23
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java

@ -0,0 +1,23 @@
package com.epmet.plugins.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 7工作日志党员志愿者服务近12月趋势图
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/27 19:55
*/
@Data
public class VoluntaryServiceTrendResultDTO implements Serializable {
private static final long serialVersionUID = -560895826884970305L;
private List<String> xAxis=new ArrayList<>();
//组织次数:organize;参与人数:joinuser;平均参与人数:avguser
private List<Integer> organizeList=new ArrayList<>();
private List<Integer> joinUserList=new ArrayList<>();
private List<Integer> avgUserList=new ArrayList<>();
}

7
epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java

@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -29,4 +30,10 @@ public class WorkRecordRankResultDTO implements Serializable {
*下级排行列表
*/
private List<WorkRecordSubRank> subRankList;
public WorkRecordRankResultDTO() {
this.participateTotal=0;
this.participateUserTotal=0;
this.subRankList=new ArrayList<>();
}
}

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

Loading…
Cancel
Save