Browse Source

Merge branch 'dev' into dev_openapi

# Conflicts:
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
feature/evaluate
wxz 4 years ago
parent
commit
0556718666
  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. 8
      epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java
  14. 36
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  15. 1
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  16. 6
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  17. 2
      epmet-cloud-generator/src/main/resources/application.yml
  18. 4
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
  19. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java
  20. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  21. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  22. 121
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java
  23. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  24. 22
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  25. 153
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  26. 43
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java
  27. 37
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  28. 45
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
  29. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java
  30. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  31. 94
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
  32. 6
      epmet-gateway/src/main/resources/bootstrap.yml
  33. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/GroupConstant.java
  34. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java
  35. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java
  36. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java
  37. 35
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/form/CandidateListFormDTO.java
  38. 57
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/result/CandidateListResultDTO.java
  39. 29
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/ResiGroupController.java
  40. 22
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java
  41. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiGroupDao.java
  42. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java
  43. 47
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java
  44. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java
  45. 30
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  46. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java
  47. 58
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java
  48. 34
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml
  49. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiGroupDao.xml
  50. 41
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java
  51. 41
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java
  52. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java
  53. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java
  54. 43
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java
  55. 41
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java
  56. 6
      epmet-module/data-report/data-report-server/pom.xml
  57. 19
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java
  58. 16
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java
  59. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java
  60. 54
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java
  61. 15
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java
  62. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml
  63. 40
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml
  64. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java
  65. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java
  66. 27
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java
  67. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java
  68. 43
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java
  69. 43
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java
  70. 61
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java
  71. 56
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java
  72. 33
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java
  73. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  74. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java
  75. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java
  76. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java
  77. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java
  78. 46
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java
  79. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  80. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java
  81. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  82. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java
  83. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java
  84. 63
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java
  85. 63
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java
  86. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyDataEntity.java
  87. 49
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java
  88. 47
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java
  89. 83
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java
  90. 95
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java
  91. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java
  92. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java
  93. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java
  94. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java
  95. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java
  96. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java
  97. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java
  98. 50
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java
  99. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java
  100. 122
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.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);
}
}
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -77,7 +77,7 @@ public abstract class BaseRequestLogAspect {
return result;
} catch (ValidateException e) {
result = handleValidateException(e);
resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e));
resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e));
} catch (DuplicateKeyException e) {
result = handlerDuplicateKeyException(e);
resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMessage(), ExceptionUtils.getErrorStackTrace(e));

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

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

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

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

@ -125,9 +125,12 @@ public enum EpmetErrorCode {
// 党建声音 前端提示 88段
DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"),
ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"),
REPEATED_SUBMIT_ERROR(8998, "请勿重复提交"),
CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"),
DRAFT_CONTENT_FILENAME_NULL(8802, "附件名称不能为空"),
ARTICLE_PUBLISH_ERROR(8803, "发布文章失败,请刷新重试"),
REPEATED_SUBMIT_ERROR(8804, "请勿重复提交"),
CUSTOMER_VALIDATE_ERROR(8805, "内部数据校验异常"),
CATEGORY_IS_NULL(8806, "请设置分类"),
//公众号 865..开头的码
PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"),
@ -145,12 +148,15 @@ public enum EpmetErrorCode {
TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"),
TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"),
CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"),
CATEGORY_NAME(9102,"分类名称已存在,不允许重复"),
// open api异常
OPEN_API_UNAUTHENTICATED(9100, "请求未认证"),
OPEN_API_TOKEN_EXPIRED(9102, "Token过期"),
OPEN_API_PARAMS_MISSING(9103, "参数不完整"),
OPEN_API_SIGN_ERROR(9104, "签名错误"),
OPEN_API_PARAMS_APPID_DIFF(9105, "app_id不一致"); // app_id在请求参数中和在token中不一致
OPEN_API_UNAUTHENTICATED(10100, "请求未认证"),
OPEN_API_TOKEN_EXPIRED(10102, "Token过期"),
OPEN_API_PARAMS_MISSING(10103, "参数不完整"),
OPEN_API_SIGN_ERROR(10104, "签名错误"),
OPEN_API_PARAMS_APPID_DIFF(10105, "app_id不一致"); // app_id在请求参数中和在token中不一致
private int code;
private String msg;

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

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

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

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

@ -43,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
*/
@ -406,4 +399,34 @@ public class RedisKeys {
public static String getOpenApiNonceKey(String nonce) {
return rootPrefix.concat("openapi:nonce:").concat(nonce);
}
/**
* desc: 根据文件路径获取oss 文件缓存key
*
* @param path
* @return java.lang.String
* @author LiuJanJun
* @date 2021/3/30 9:56 上午
*/
public static String getOssFileKey(String path) {
return rootPrefix.concat("oss:temp:").concat(path);
}
/**
* 一个客户对应多个第三方平台多个ApiService的key
* @param customerId
* @return
*/
public static String listCustomerApiServiceListKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservicelist:").concat(customerId);
}
/**
* 查询第三方平台access token
* @param platformId
* @return
*/
public static String getThirdPlatformAccessTokenKey(String platformId) {
return rootPrefix.concat("thirdplatform:accesstoken:").concat(platformId);
}
}

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

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

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

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

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

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

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

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

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

@ -461,10 +461,16 @@ epmet:
- /gov/project/**
- /resi/home/**
- /data/report/**
- /epmet/ext/**
- /data/stats/**
- /data/aggregator/**
- /gov/voice/**
- /resi/voice/**
# 内部认证url白名单(在白名单中的,就不会再校验登录了)
internalAuthUrlsWhiteList:
- /epmetuser/customerstaff/customerlist
- /gov/project/project/platformcallback
# 外部应用认证,使用AccessToken等头进行认证
externalOpenUrls:

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

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

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

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

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

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

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java

@ -17,9 +17,10 @@
package com.epmet.dataaggre.dto.resigroup;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
@ -49,7 +50,7 @@ public class ResiTopicCommentDTO implements Serializable {
private String topicId;
/**
* 评论状态
* 评论状态讨论中discussing已屏蔽 :hidden
*/
private String status;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -0,0 +1,43 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.project.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class CustomerCategoryDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 父id
* pid = 0 查询一级分类
* pid != 0 查询二级分类
*/
private String pid;
/**
* 客户Id
*/
private String customerId;
}

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

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

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

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

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

@ -16,10 +16,7 @@ import com.epmet.project.dto.form.DifficultyRankFormDTO;
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO;
import com.epmet.project.dto.result.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -129,4 +126,18 @@ public class ProjectController {
public Result<List<ProjectNextAgencyResultDTO>> myNextAgency(@LoginUser TokenDto tokenDto){
return new Result<List<ProjectNextAgencyResultDTO>>().ok(projectService.getMyNextAgency(tokenDto));
}
/**
* 002项目分类字典查询
* 查询当前客户的父客户下项目分类字典
*
* @param customerId
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.project.dto.result.ProjectCategoryDictResultDTO>>
* @Author zhangyong
* @Date 10:41 2021-03-22
**/
@PostMapping("categorydict")
public Result<List<ProjectCategoryDictResultDTO>> categoryDict(@RequestHeader("CustomerId") String customerId) {
return new Result<List<ProjectCategoryDictResultDTO>>().ok(projectService.getCategoryDict(customerId));
}
}

16
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java

@ -205,17 +205,20 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW
}
//2.查询当前月过去12个月份
Map<String, String> map = dateUtils.getXpro();
Map<String, String> map = dateUtils.getXproSub();
resultDTO.setXAxis(map.values().stream().collect(Collectors.toList()));
List<String> monthIdList = map.keySet().stream().collect(Collectors.toList());
//3-1.查询当前组织及所有下级过去12个月份某项数据所有资源的统计数据
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMM");
LocalDate today = LocalDate.now();
formDTO.setStartMonth(today.minusMonths(NumConstant.THIRTEEN).format(fmt));
formDTO.setEndMonth(today.minusMonths(NumConstant.ONE).format(fmt));
formDTO.setStartMonth(monthIdList.get(NumConstant.ZERO));
formDTO.setEndMonth(monthIdList.get(NumConstant.ELEVEN));
List<WorkRecordTrendResultDTO.SeriesResultDTO> list = screenWorkRecordOrgMonthlyDao.selectMonthList(formDTO);
/*log.info("legendList:"+ JSON.toJSONString(legendList,true));
log.info("xAxis:"+JSON.toJSONString(resultDTO.getXAxis(),true));
log.info("monthIdList:"+JSON.toJSONString(monthIdList,true));
log.info("startMonth:"+formDTO.getStartMonth()+";endMonth="+formDTO.getEndMonth());*/
//3-2.遍历封装数据并返回
LinkedList<WorkRecordTrendResultDTO.SeriesResultDTO> seriesList = new LinkedList<>();
//按资源类型封装每一个资源类型对应的过去12个月的汇总数据,某个月份没有数据的补0
@ -253,8 +256,9 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl<ScreenW
public VoluntaryServiceTrendResultDTO voluntaryServiceTrend(VoluntaryServiceTrendFormDTO formDTO) {
VoluntaryServiceTrendResultDTO resultDTO = new VoluntaryServiceTrendResultDTO();
//近12个月的monthId集合,["202002","202003","202004","202005","202006","202007","202008","202009","202010","202011","202012","202101"]
//截止到上个月
List<String> monthIdList = com.epmet.commons.tools.utils.DateUtils.getMonthIdList(formDTO.getEndMonthId(), NumConstant.ELEVEN);
// log.info(JSON.toJSONString(monthIdList));
log.info(JSON.toJSONString(monthIdList));
AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId());
List<String> orgIds = new ArrayList<>();

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/ProjectService.java

@ -70,4 +70,14 @@ public interface ProjectService {
* @date 2020.10.19 16:38
**/
List<ProjectNextAgencyResultDTO> getMyNextAgency(TokenDto tokenDto);
/**
* 002项目分类字典查询
*
* @param customerId
* @return java.util.List<com.epmet.project.dto.result.ProjectCategoryDictResultDTO>
* @Author zhangyong
* @Date 14:26 2021-03-22
**/
List<ProjectCategoryDictResultDTO> getCategoryDict(String customerId);
}

54
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.datareport.service.project.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -18,20 +19,21 @@ import com.epmet.dto.form.ProcessListFormDTO;
import com.epmet.dto.form.SubAgencyFormDTO;
import com.epmet.dto.result.*;
import com.epmet.evaluationindex.screen.dto.result.DepartmentNameListResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.GovProjectOpenFeignClient;
import com.epmet.feign.*;
import com.epmet.project.constant.ProjectConstant;
import com.epmet.project.dto.CustomerCategoryDTO;
import com.epmet.project.dto.FactAgencyProjectDailyDTO;
import com.epmet.project.dto.form.DifficultyRankFormDTO;
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO;
import com.epmet.project.dto.result.ProjectDetailResultDTO;
import com.epmet.project.dto.result.*;
import com.epmet.project.dto.result.ProjectDetailResultDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -50,7 +52,7 @@ import java.util.List;
@Slf4j
@Service
public class ProjectServiceImpl implements ProjectService {
private Logger logger = LogManager.getLogger(getClass());
@Autowired
private ProjectDao projectDao;
@Autowired
@ -64,6 +66,11 @@ public class ProjectServiceImpl implements ProjectService {
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private ResiGroupOpenFeignClient resiGroupOpenFeignClient;
@Autowired
private GovIssueOpenFeignClient govIssueOpenFeignClient;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
/**
* @Author sun
* @Description 数据-项目-获取汇总数据
@ -350,4 +357,41 @@ public class ProjectServiceImpl implements ProjectService {
return result;
}
@Override
public List<ProjectCategoryDictResultDTO> getCategoryDict(String customerId) {
List<ProjectCategoryDictResultDTO> result = new ArrayList<>();
Result<String> parentCustomerId = operCrmOpenFeignClient.getExternalAndParentCustomerId(customerId);
if (!parentCustomerId.success() && null == parentCustomerId.getData()) {
logger.warn(String.format("调用%s服务查询外部客户的 父级客户ID 失败,入参%s", ServiceConstant.OPER_CRM_SERVER,
JSON.toJSONString(customerId)));
return result;
}
CustomerCategoryDTO argDto = new CustomerCategoryDTO();
argDto.setCustomerId(parentCustomerId.getData());
argDto.setPid(NumConstant.ZERO_STR);
// 获取客户一级分类
Result<List<ProjectCategoryDictResultDTO>> parentCategoryDict = govIssueOpenFeignClient.getCustomerCategoryDict(argDto);
if (!parentCategoryDict.success()) {
logger.warn(String.format("调用%s服务查询当前客户的父客户下,项目分类字典失败,入参%s", ServiceConstant.GOV_ISSUE_SERVER,
JSON.toJSONString(customerId)));
} else {
result = parentCategoryDict.getData();
// 获取客户二级分类
argDto.setPid(NumConstant.TWO_STR);
Result<List<ProjectCategoryDictResultDTO>> childrenCategoryDict = govIssueOpenFeignClient.getCustomerCategoryDict(argDto);
for (ProjectCategoryDictResultDTO p : result) {
List<ProjectCategoryDictResultDTO> children = new ArrayList<>();
for (ProjectCategoryDictResultDTO c : childrenCategoryDict.getData()) {
if (p.getId().equals(c.getPid())) {
ProjectCategoryDictResultDTO dto = new ProjectCategoryDictResultDTO();
dto.setCategoryCode(c.getCategoryCode());
dto.setCategoryName(c.getCategoryName());
children.add(dto);
}
}
p.setChildren(children);
}
}
return result;
}
}

15
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java

@ -75,6 +75,21 @@ public class DateUtils {
return result;
}
public Map<String,String> getXproSub(){
Map<String,String> xAxis = new HashMap<>();
LocalDate today = LocalDate.now();
for(int i = NumConstant.TWELVE;i > NumConstant.ZERO; i--){
LocalDate localDate = today.minusMonths(i);
String s = localDate.getMonth().getValue() + "月";
xAxis.put(localDate.format(fmt),s);
}
Map<String, String> result = Maps.newLinkedHashMap();
xAxis.entrySet().stream().sorted(Map.Entry.comparingByKey())
.forEachOrdered((e -> result.put(e.getKey(),e.getValue())));
return result;
}
public Map<String,String> getXproEndMonth(String monthId){
Map<String,String> xAxis = new HashMap<>();
for(int i=NumConstant.ZERO;i <= NumConstant.ELEVEN; i++){

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml

@ -28,6 +28,7 @@
AND sw.month_id &gt;= #{startMonth}
AND sw.month_id <![CDATA[ <= ]]> #{endMonth}
AND wrd.data_type = #{dataType}
and sw.CUSTOMER_ID=#{customerId}
GROUP BY
sw.month_id,sw.meeting_code
ORDER BY
@ -43,6 +44,7 @@
FROM
screen_work_record_org_monthly m
WHERE m.DEL_FLAG = '0'
and m.CUSTOMER_ID=#{customerId}
AND m.TYPE_CODE =(
SELECT
dict.RESOURCE_CODE

40
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -5,24 +5,26 @@
<select id="selectCategoryAnalysis" resultType="com.epmet.dto.result.screen.CategoryAnalysisResultDTO">
SELECT EPMET_CATEGORY_NAME AS categoryName,
PROJECT_TOTAL AS projectTotal
FROM screen_project_category_org_daily
WHERE DEL_FLAG = '0'
AND ORG_ID = #{agencyId}
AND DATE_ID = (
select
date_id
from
screen_project_category_org_daily
where
del_flag = '0'
and ORG_ID = #{agencyId}
order by
date_id desc,
created_time desc
limit 1
)
ORDER BY EPMET_CATEGORY_CODE
SELECT D.CATEGORY_NAME AS categoryName,
M.PROJECT_TOTAL AS projectTotal
FROM screen_project_category_org_daily m
left join customer_project_category_dict d
on(m.CATEGORY_CODE=D.CATEGORY_CODE AND D.DEL_FLAG='0')
WHERE M.DEL_FLAG = '0'
AND M.ORG_ID = #{agencyId}
AND M.DATE_ID = (
select
date_id
from
screen_project_category_org_daily
where
del_flag = '0'
and ORG_ID = #{agencyId}
order by
date_id desc,
created_time desc
limit 1
)
ORDER BY M.CATEGORY_CODE ASC
</select>
</mapper>

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java

@ -53,6 +53,11 @@ public class IssueProjectCategoryDictDTO implements Serializable {
*/
private String pids;
/**
* 上级分类编码
*/
private String parentCategoryCode;
/**
* 分类编码分类编码+customer_id唯一
*/
@ -73,6 +78,11 @@ public class IssueProjectCategoryDictDTO implements Serializable {
*/
private Integer sort;
/**
* 是否禁用(enable:启用 disable:禁用)
*/
private String isDisable;
/**
* 删除标识 0未删除1已删除
*/

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java

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

27
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.screen;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.dto.screen.form.CategoryDictFormDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 项目分类字典上报
* @Auther: zhangyong
* @Date: 2021-03-22
*/
@Data
public class CategoryDictDataFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当isFirst=true时直接根据 customerId 删除原有数据再批量insert
*/
private Boolean isFirst;
private List<CategoryDictFormDTO> dataList;
}

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java

@ -112,5 +112,7 @@ public class ScreenCustomerGridDTO implements Serializable {
* 所有上级ID用英文逗号分开
*/
private String allParentIds;
private String pid;
private String pids;
}

43
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java

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

43
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java

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

61
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java

@ -0,0 +1,61 @@
package com.epmet.dto.screen.form;
import lombok.Data;
import java.io.Serializable;
/**
* 项目分类字典上报
* @Auther: zhangyong
* @Date: 2021-03-22
*/
@Data
public class CategoryDictFormDTO implements Serializable {
private static final long serialVersionUID = 1245827825857891963L;
/**
* 客户内自己的分类编码
*/
private String categoryCode;
/**
* 客户内自己的分类名称
*/
private String categoryName;
/**
* 父类分类编码如果是一级分类此列赋值为0
*/
private String parentCategoryCode;
/**
* 分类等级12....
*/
private Integer level;
/**
* 排序
*/
private Integer sort;
/**
* 当前分类对应产品内的分类编码如果对应不上此列传空
*/
private String epmetCategoryCode;
/**
* 原始创建时间yyyy-MM-dd HH:mm:ss
*/
private String originCreatedTime;
/**
* 原始更新时间yyyy-MM-dd HH:mm:ss
*/
private String orginUpdatedTime;
/**
* 分类字典表主键
*/
private String categoryId;
}

56
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java

@ -0,0 +1,56 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/3/23 下午2:38
* @DESC
*/
@Data
public class CategoryProjectResultDTO implements Serializable {
private static final long serialVersionUID = -5774330825880917524L;
private String pid;
private String pids;
/**
* 组织ID
*/
private String orgId;
/**
* 客户ID
*/
private String customerId;
/**
* 分类码
*/
private String categoryCode;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 分类级别
*/
private Integer level;
/**
* 日期ID
*/
private String dateId;
/**
* 组织级别
*/
private String orgType;
private Boolean status = false;
}

33
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java

@ -17,25 +17,58 @@ import java.util.List;
public class UserStatisticalData implements Serializable {
private static final long serialVersionUID = 7423427555123585566L;
/**
* 机关下(按日)参与用户数分析
*/
private List<FactParticipationUserAgencyDailyDTO> partiAgencyDailyList;
/**
* 网格下(按日)参与用户数分析
*/
private List<FactParticipationUserGridDailyDTO> partiGridDailyList;
/**
* 机关下(按月)参与用户数分析
*/
private List<FactParticipationUserAgencyMonthlyDTO> partiAgencyMonthlyList;
/**
* 网格下()参与用户数分析
*/
private List<FactParticipationUserGridMonthlyDTO> partiGridMonthlyList;
/**
* 机关(按日)注册用户数分析
*/
private List<FactRegUserAgencyDailyDTO> regAgencyDailyList;
/**
* 网格(按日)注册用户数分析
*/
private List<FactRegUserGridDailyDTO> regGridDailyList;
/**
* 机关(按月)注册用户数分析
*/
private List<FactRegUserAgencyMonthlyDTO> regAgencyMonthlyList;
/**
* 网格()注册用户数分析
*/
private List<FactRegUserGridMonthlyDTO> regGridMonthlyList;
/**
* 当前正在计算的客户id
*/
private String customerId;
/**
* yyyyMMdd
*/
private String dateId;
/**
* yyyyMM
*/
private String monthId;
}

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -2,6 +2,7 @@ package com.epmet.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
@ -34,13 +35,11 @@ import com.epmet.entity.stats.DimDateEntity;
import com.epmet.entity.stats.DimMonthEntity;
import com.epmet.service.StatsDemoService;
import com.epmet.service.evaluationindex.extract.dataToIndex.*;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService;
import com.epmet.service.evaluationindex.extract.toscreen.*;
import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.service.evaluationindex.screen.ScreenProjectGridDailyService;
import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService;
import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityGridMonthlyService;
import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService;
import com.epmet.service.evaluationindex.screen.*;
import com.epmet.service.stats.DimAgencyService;
import com.epmet.service.stats.DimCustomerPartymemberService;
import lombok.extern.slf4j.Slf4j;
@ -49,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.ExecutionException;
@ -103,6 +103,13 @@ public class DemoController {
private GovernRankDataExtractService governRankDataExtractService;
@Autowired
private OrgRankExtractService orgRankExtractService;
@Autowired
private ScreenProjectSettleService screenProjectSettleService;
@Autowired
private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService;
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@GetMapping("testAlarm")
public void testAlarm() {
//for (int i = 0; i < 20; i++) {
@ -815,8 +822,6 @@ public class DemoController {
return new Result();
}*/
@Autowired
private ScreenProjectSettleService screenProjectSettleService;
@PostMapping("project-test")
public Result project(@RequestBody ScreenCentralZoneDataFormDTO param){
screenProjectSettleService.extractScreenData(param);
@ -828,4 +833,40 @@ public class DemoController {
System.out.println(monthId);
}
}
/**
* @return com.epmet.commons.tools.utils.Result
* @param customerId
* @author yinzuomei
* @description 产品内部计算网格内按分类统计项目数量
* @Date 2021/3/23 10:52
**/
@PostMapping("extractProjectCategoryData")
public Result extractProjectCategoryData(@RequestParam("customerId") String customerId){
String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", "");
projectCategoryGridDailyService.extractProjectCategoryData(customerId,dateId);
return new Result();
}
/**
* @return com.epmet.commons.tools.utils.Result
* @author yinzuomei
* @description 将epmet_gov_project库中的项目分类信息project_category同步到统计库epmet_data_statistical
* @Date 2021/3/23 10:52
**/
@PostMapping("extractProjectCategory")
public Result extractProjectCategory(@RequestBody ExtractOriginFormDTO formDTO){
originProjectCategoryDailyService.extractProjectCategory(formDTO);
return new Result();
}
@Autowired
private ScreenProjectCategoryOrgDailyService screenProjectCategoryOrgDailyService;
@PostMapping("orgdaily")
public Result orgDaily(@RequestParam("customerId")String customerId,@RequestParam("dateId")String dateId){
screenProjectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,dateId);
return new Result();
}
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java

@ -1,7 +1,6 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.AgencySubDeptTreeDto;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
@ -105,6 +104,13 @@ public class DimController {
} catch (Exception e) {
logger.error("初始化按周维度失败:", e);
}
//项目分类字典维度 初始化 每天晚上凌晨10分执行
try {
statsDimService.customerInitProjectCategory();
logger.info("初始化项目分类成功");
} catch (Exception e) {
logger.error("初始化项目分类失败:", e);
}
return new Result();
}

27
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java

@ -3,16 +3,15 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.screen.*;
import com.epmet.dto.screen.form.CategoryDictFormDTO;
import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO;
import com.epmet.dto.screen.form.ScreenProjectProcessFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.service.evaluationindex.screen.*;
import com.epmet.service.stats.CustomerProjectCategoryDictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @Description 事件/项目采集接口入口
@ -41,7 +40,8 @@ public class ScreenProjectDataCollController {
private ScreenProjectDataService projectDataService;
@Autowired
private ScreenProjectProcessService projectProcessService;
@Autowired
private CustomerProjectCategoryDictService customerProjectCategoryDictService;
/**
* @author wangc
* @description 事件/项目分析网格内月度数量统计
@ -152,4 +152,21 @@ public class ScreenProjectDataCollController {
return new Result();
}
/**
* 项目分类字典上报
* 目标表epmet_evaluation_index库的customer_project_category_dict
*
* @param customerId
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 16:03 2021-03-22
**/
@PostMapping("uploadcategorydict")
public Result uploadcategorydict(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO<CategoryDictFormDTO> formDTO) {
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class);
customerProjectCategoryDictService.uploadCategoryDict(formDTO);
return new Result();
}
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java

@ -21,6 +21,12 @@ public class StatsUserController {
@Autowired
private StatsUserService statsUserService;
/**
* @return com.epmet.commons.tools.utils.Result
* @param formDTO
* @description 工作端数据一期用户分析参与用户注册用户分析
* @Date 2021/3/26 13:27
**/
@RequestMapping("execute")
public Result execute(@RequestBody StatsFormDTO formDTO) {
statsUserService.partition(formDTO);

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java

@ -43,4 +43,12 @@ public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
CustomerSubInfoDTO selectCustomerSubInfo(@Param("customerId")String customerId);
List<CustomerRelationEntity> selectListByPids(String customerId);
/**
* @Description 查询子级客户
* @Param customerId
* @author zxc
* @date 2021/3/23 上午10:21
*/
List<CustomerRelationEntity> selectSubCustomer(@Param("customerId") String customerId);
}

46
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-19
*/
@Mapper
public interface FactOriginProjectCategoryDailyDao extends BaseDao<FactOriginProjectCategoryDailyEntity> {
void deleteOldData(@Param("customerId") String customerId,@Param("dateId") String dateId);
/**
* @param customerId
* @author yinzuomei
* @description 计算当前客户下各个网格内各项目分类下项目数量
* @Date 2021/3/23 9:58
**/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(@Param("customerId") String customerId);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -194,4 +194,13 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @date 2021/1/28 下午3:18
*/
List<ScreenProjectGridDailyDTO> selectGridInfoByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询直属网格信息
* @Param customerId
* @Param level
* @author zxc
* @date 2021/3/23 下午4:03
*/
List<ScreenCustomerGridDTO> selectBelongGridInfo(@Param("customerId") String customerId,@Param("level") String level);
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java

@ -18,10 +18,13 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.result.CategoryProjectResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryGridDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目(事件)分类按网格_按天统计
*
@ -39,4 +42,13 @@ public interface ScreenProjectCategoryGridDailyDao extends BaseDao<ScreenProject
* @return int
*/
int deleteByDateIdAndCustomerId(@Param("customerId") String customerId, @Param("dateId") String dateId);
/**
* @Description 查询分类信息
* @Param customerId
* @Param dateId
* @author zxc
* @date 2021/3/23 下午2:49
*/
List<CategoryProjectResultDTO> selectCategoryInfo(@Param("customerId") String customerId,@Param("dateId") String dateId,@Param("level")String level,@Param("gridIds")List<String> gridIds);
}

26
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -18,10 +18,14 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.result.CategoryProjectResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目(事件)分类按组织_按天统计
*
@ -39,4 +43,26 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao<ScreenProjectC
* @return int
*/
int deleteByDateIdAndCustomerId(@Param("customerId") String customerId, @Param("dateId") String dateId);
/**
* @Description 查询组织分类信息
* @Param customerId
* @Param dateId
* @Param level 组织级别
* @author zxc
* @date 2021/3/23 下午3:22
*/
List<CategoryProjectResultDTO> selectOrgCategoryInfo(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("level")String level);
/**
* @Description 查询组织分类信息多客户
* @Param customerId
* @Param dateId
* @Param level
* @Param existsStatus 父客户是否存在
* @author zxc
* @date 2021/3/24 下午2:48
*/
List<CategoryProjectResultDTO> selectOrgCategoryMoreCustomerInfo(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("level")String level, @Param("customerId")String customerId, @Param("existsStatus")Boolean existsStatus);
}

41
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java

@ -0,0 +1,41 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.issue;
import com.epmet.entity.issue.IssueProjectCategoryDictEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 议题项目分类字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-08
*/
@Mapper
public interface IssueProjectCategoryDictDao {
List<IssueProjectCategoryDictEntity> listInsertCategoies(@Param("start") Date start, @Param("end") Date end);
List<IssueProjectCategoryDictEntity> listByUpdatedTime(@Param("start") Date start, @Param("end") Date end);
IssueProjectCategoryDictEntity getById(@Param("customerId")String customerId, @Param("id")String id);;
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java

@ -133,4 +133,6 @@ public interface ProjectDao extends BaseDao<ProjectEntity> {
* @date 2021.03.08 23:44
*/
List<ProjectCategoryDTO> selectProjectCategory(@Param("list")List<String> list);
}
List<com.epmet.dto.ProjectCategoryDTO> getProjectCategoryData(@Param("customerId") String customerId, @Param("dateId") String dateId);
}

63
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java

@ -0,0 +1,63 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.form.CategoryDictFormDTO;
import com.epmet.entity.stats.CustomerProjectCategoryDictEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户项目分类字典表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-19
*/
@Mapper
public interface CustomerProjectCategoryDictDao extends BaseDao<CustomerProjectCategoryDictEntity> {
CustomerProjectCategoryDictEntity getLatestProjectCategory();
CustomerProjectCategoryDictEntity getLatestUpdatedEntity();
CustomerProjectCategoryDictEntity selectByCustomerIdAndId(@Param("customerId") String customerId, @Param("categoryId") String categoryId);
/**
* 当isFirst=true时直接根据 customerId 删除原有数据再批量insert
*
* @param customerId
* @return java.lang.Integer
* @Author zhangyong
* @Date 16:12 2021-03-22
**/
Integer deleteCustomerProjectCategoryDict(@Param("customerId") String customerId);
/**
* 批量insert
*
* @param list
* @param customerId
* @return void
* @Author zhangyong
* @Date 16:13 2021-03-22
**/
void batchInsertCustomerProjectCategoryDict(@Param("list") List<CategoryDictFormDTO> list, @Param("customerId")String customerId);
}

63
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java

@ -0,0 +1,63 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.extract;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_origin_project_category_daily")
public class FactOriginProjectCategoryDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 项目id
*/
private String projectId;
/**
* 分类编码
*/
private String categoryCode;
/**
* 所属父类分类编码
*/
private String parentCategoryCode;
/**
* 分类等级12....产品目前只有2级分类
*/
private Integer level;
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyDataEntity.java

@ -61,7 +61,7 @@ public class ScreenDifficultyDataEntity extends BaseEpmetEntity {
private String orgName;
/**
* 事件原Id
* 事件原Id项目Id
*/
private String eventId;

49
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java

@ -18,14 +18,10 @@
package com.epmet.entity.evaluationindex.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 项目(事件)分类按网格_按天统计
*
@ -65,50 +61,17 @@ public class ScreenProjectCategoryGridDailyEntity extends BaseEpmetEntity {
private String pids;
/**
* e世通中的项目类别编码
* 项目类别编码
*/
private String epmetCategoryCode;
private String epmetCategoryName;
private String categoryCode;
/**
* 该分类下所有项目总数
*/
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
*/
private BigDecimal unResolvedRatio;
/**
* 分类等级12....
*/
private Integer level;
}

47
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java

@ -18,14 +18,10 @@
package com.epmet.entity.evaluationindex.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 项目(事件)分类按组织_按天统计
*
@ -72,48 +68,15 @@ public class ScreenProjectCategoryOrgDailyEntity extends BaseEpmetEntity {
/**
* e世通中的项目类别编码
*/
private String epmetCategoryCode;
private String epmetCategoryName;
private String categoryCode;
/**
* 该分类下所有项目总数
*/
private Integer projectTotal;
/**
* 该分类下正在处理中的项目总数
*/
private Integer pendingTotal;
/**
* 该分类下已结案的项目总数
*/
private Integer closedTotal;
/**
* 该分类下已结案无需解决的项目总数
*/
private Integer unResolvedTotal;
/**
* 该分类下已结案已解决的项目总数
*/
private Integer resolvedTotal;
/**
* 该分类下项目结案率
*/
private BigDecimal closedRatio;
/**
* 该分类下已结案项目解决率
*/
private BigDecimal resolvedRatio;
/**
* 该分类下已结案项目未解决率
*/
private BigDecimal unResolvedRatio;
/**
* 分类等级12....
*/
private Integer level;
}

83
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java

@ -0,0 +1,83 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.issue;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 议题项目分类字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-08
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("issue_project_category_dict")
public class IssueProjectCategoryDictEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id, 产品默认default
*/
private String customerId;
/**
* 上级分类ID 顶级此列存储0
*/
private String pid;
/**
* 所有上级分类ID用逗号分开
*/
private String pids;
/**
* 上级分类编码
*/
private String parentCategoryCode;
/**
* 分类编码分类编码+customer_id唯一
*/
private String categoryCode;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类类别1,2,3,4....
*/
private String categoryType;
/**
* 排序
*/
private Integer sort;
/**
* 是否禁用(enable:启用 disable:禁用)
*/
private String isDisable;
}

95
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.stats;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户项目分类字典表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("customer_project_category_dict")
public class CustomerProjectCategoryDictEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 外部客户external;内部客户internal
*/
private String customerType;
/**
* 客户自己的分类编码
*/
private String categoryCode;
/**
* 客户自己的分类名称
*/
private String categoryName;
/**
* 父类分类编码如果是一级分类此列赋值为0
*/
private String parentCategoryCode;
/**
* 分类等级12....产品只有2级分类
*/
private Integer level;
/**
* 排序
*/
private Integer sort;
/**
* 是否禁用(enable:启用 disable:禁用)
*/
private String isDisable;
/**
* 对应e世通中的分类编码没有此列为空
*/
private String epmetCategoryCode;
/**
* 创建时间
*/
private Date originCreatedTime;
/**
* 修改时间
*/
private Date originUpdatedTime;
private String categoryId;
}

39
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java

@ -0,0 +1,39 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.Issue;
import com.epmet.entity.issue.IssueProjectCategoryDictEntity;
import java.util.Date;
import java.util.List;
/**
* 议题项目分类字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-08
*/
public interface IssueProjectCategoryDictService{
List<IssueProjectCategoryDictEntity> listInsertCategoies(Date start, Date end);
List<IssueProjectCategoryDictEntity> listByUpdatedTime(Date start, Date end);
IssueProjectCategoryDictEntity getById(String customerId,String id);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java

@ -176,7 +176,7 @@ public interface IssueService {
List<IssueVoteStatisticalResultDTO> selectIssueVoteStatis(String customerId, String monthId);
/**
* @Description 查找项目的分类名称 -相连
* @Description 查找项目的分类名称 -相连,分隔
* @param param
* @return java.util.Map<java.lang.String,java.lang.String>
* @author wangc

42
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java

@ -0,0 +1,42 @@
package com.epmet.service.Issue.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.issue.IssueProjectCategoryDictDao;
import com.epmet.entity.issue.IssueProjectCategoryDictEntity;
import com.epmet.service.Issue.IssueProjectCategoryDictService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/3/19 15:29
*/
@Service
@DataSource(DataSourceConstant.GOV_ISSUE)
public class IssueProjectCategoryDictServiceImpl implements IssueProjectCategoryDictService {
@Autowired
private IssueProjectCategoryDictDao issueProjectCategoryDictDao;
@Override
public List<IssueProjectCategoryDictEntity> listInsertCategoies(Date start, Date end) {
return issueProjectCategoryDictDao.listInsertCategoies(start, end);
}
@Override
public List<IssueProjectCategoryDictEntity> listByUpdatedTime(Date start, Date end) {
return issueProjectCategoryDictDao.listByUpdatedTime(start, end);
}
@Override
public IssueProjectCategoryDictEntity getById(String customerId, String id) {
return issueProjectCategoryDictDao.getById(customerId,id);
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.Issue.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.issue.StatsIssueDao;
import com.epmet.dto.extract.result.IssueInfoResultDTO;
@ -146,14 +147,22 @@ public class IssueServiceImpl implements IssueService {
return statsIssueDao.selectIssueVoteStatis(customerId, dateId);
}
/**
* @Description 查找项目的分类名称 -相连,分隔
* @param param
* @return java.util.Map<java.lang.String,java.lang.String>
* @author wangc
* @date 2021.03.09 00:23
*/
@Override
public Map<String, String> getIntegratedProjectCategory(Map<String, Set<String>> param,String customerId) {
Map<String, String> map = new HashMap<>();
param.forEach((projectId,categoryIds) -> {
//以下查询只适用于二级分类,如果分类层级变多了要修改此查询
List<IssueProjectCategoryDictDTO> categories = statsIssueDao.selectCategory(customerId, categoryIds);
if(!CollectionUtils.isEmpty(categories)){
StringBuilder str = new StringBuilder();
categories.forEach(category -> {str.append(category.getCategoryName()).append("-");});
categories.forEach(category -> {str.append(category.getCategoryName()).append(StrConstant.COMMA);});
map.put(projectId,str.substring(NumConstant.ZERO,str.length() - NumConstant.TWO));
}
});

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java

@ -10,4 +10,6 @@ public interface StatsDimService {
void initCustomerDim();
void initDepartmentDim();
void customerInitProjectCategory();
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java

@ -22,6 +22,8 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.indexcal.CustomerSubInfoDTO;
import com.epmet.entity.crm.CustomerRelationEntity;
import java.util.List;
/**
* 客户关系表(01.14 add)
*
@ -40,4 +42,12 @@ public interface CustomerRelationService extends BaseService<CustomerRelationEnt
CustomerSubInfoDTO getCustomerSubInfo(String customerId);
boolean haveSubCustomer(String customerId);
/**
* @Description 查询子级客户
* @Param customerId
* @author zxc
* @date 2021/3/23 上午10:21
*/
List<CustomerRelationEntity> selectSubCustomer(String customerId);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java

@ -27,9 +27,11 @@ import com.epmet.entity.crm.CustomerRelationEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.stats.DimCustomerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -70,4 +72,18 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
}
return true;
}
/**
* @Description 查询子级客户
* @Param customerId
* @author zxc
* @date 2021/3/23 上午10:21
*/
@Override
public List<CustomerRelationEntity> selectSubCustomer(String customerId) {
if (StringUtils.isEmpty(customerId)){
return new ArrayList<>();
}
return baseDao.selectSubCustomer(customerId);
}
}

50
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java

@ -0,0 +1,50 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.evaluationindex.extract.todata;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity;
import java.util.List;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-19
*/
public interface FactOriginProjectCategoryDailyService extends BaseService<FactOriginProjectCategoryDailyEntity> {
/**
* @Description 将epmet_gov_project库中的项目分类信息project_category同步到统计库epmet_data_statistical
* @param paramNew
* @return void
* @Author liushaowen
* @Date 2021/3/22 15:28
*/
void extractProjectCategory(ExtractOriginFormDTO paramNew);
/**
* @param customerId
* @author yinzuomei
* @description 计算当前客户下各个网格内各项目分类下项目数量
* @Date 2021/3/23 9:56
**/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(String customerId);
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java

@ -46,7 +46,8 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
private GroupExtractService groupExtractService;
@Autowired
private DimCustomerPartymemberService dimCustomerPartymemberService;
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@Override
public void extractAll(ExtractOriginFormDTO extractOriginFormDTO) {
@ -198,7 +199,12 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
try {
projectExtractService.extractProjectPeriodData(paramNew);
} catch (Exception e) {
log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(paramNew), e);
log.error("抽取【项目耗时数据】发生异常,参数:" + JSON.toJSONString(paramNew), e);
}
try {
originProjectCategoryDailyService.extractProjectCategory(paramNew);
} catch (Exception e) {
log.error("抽取【项目分类数据】发生异常,参数:" + JSON.toJSONString(paramNew), e);
}
} else {
try {
@ -219,6 +225,16 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
} catch (Exception e) {
log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(paramNew), e);
}
try {
for (int i = 0; i < finalDaysBetween.size(); i++) {
String dateDimId = finalDaysBetween.get(i);
paramNew.setDateId(dateDimId);
originProjectCategoryDailyService.extractProjectCategory(paramNew);
}
} catch (Exception e) {
log.error("抽取【项目分类数据】发生异常,参数:" + JSON.toJSONString(paramNew), e);
}
}
});
}

122
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java

@ -0,0 +1,122 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.evaluationindex.extract.todata.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.extract.FactOriginProjectCategoryDailyDao;
import com.epmet.dto.ProjectCategoryDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity;
import com.epmet.entity.issue.IssueProjectCategoryDictEntity;
import com.epmet.service.Issue.IssueProjectCategoryDictService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService;
import com.epmet.service.project.ProjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-19
*/
@Service
@DataSource(DataSourceConstant.STATS)
@Slf4j
public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl<FactOriginProjectCategoryDailyDao, FactOriginProjectCategoryDailyEntity> implements FactOriginProjectCategoryDailyService {
@Autowired
private ProjectService projectService;
@Autowired
private IssueProjectCategoryDictService issueProjectCategoryDictService;
/**
* @param extractOriginFormDTO
* @return void
* @Description 将epmet_gov_project库中的项目分类信息project_category同步到统计库epmet_data_statistical
* @Author liushaowen
* @Date 2021/3/22 15:28
*/
@Override
public void extractProjectCategory(ExtractOriginFormDTO extractOriginFormDTO) {
String dateString = extractOriginFormDTO.getDateId();
String customerId = extractOriginFormDTO.getCustomerId();
List<FactOriginProjectCategoryDailyEntity> entities = new ArrayList<>();
Integer count = baseDao.selectCount(new QueryWrapper<FactOriginProjectCategoryDailyEntity>().eq("customer_id",customerId));
//如果count = 0 初始化该customer所有数据
if (NumConstant.ZERO == count){
dateString = null;
}
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(customerId, dateString);
if (!CollectionUtils.isEmpty(projectCategoryData)){
projectCategoryData.forEach(data->{
FactOriginProjectCategoryDailyEntity insertEntity = new FactOriginProjectCategoryDailyEntity();
IssueProjectCategoryDictEntity categoryDictEntity = issueProjectCategoryDictService.getById(customerId, data.getCategoryId());
if (categoryDictEntity == null){
log.warn("categoryDict not found : customerId:{},categoryId:{}",customerId,data.getCategoryId());
}
insertEntity.setProjectId(data.getProjectId());
insertEntity.setCategoryCode(categoryDictEntity.getCategoryCode());
insertEntity.setParentCategoryCode(categoryDictEntity.getParentCategoryCode());
insertEntity.setCustomerId(customerId);
insertEntity.setLevel(Integer.valueOf(categoryDictEntity.getCategoryType()));
insertEntity.setCreatedTime(data.getCreatedTime());
entities.add(insertEntity);
});
if (!CollectionUtils.isEmpty(entities)){
delAndInsert(customerId,dateString,entities);
}
}
}
/**
* @Description category表删除插入
* @param customerId
* @param dateId
* @param result
* @return void
* @Author liushaowen
* @Date 2021/3/22 17:01
*/
@Transactional(rollbackFor = Exception.class)
public void delAndInsert(String customerId,String dateId,List<FactOriginProjectCategoryDailyEntity> result){
baseDao.deleteOldData(customerId, dateId);
insertBatch(result);
}
/**
* @param customerId
* @author yinzuomei
* @description 计算当前客户下各个网格内各项目分类下项目数量
* @Date 2021/3/23 9:56
**/
@Override
public List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(String customerId) {
List<ScreenProjectCategoryGridDailyDTO> list=baseDao.selectListProjectCategoryGridDailyDTO(customerId);
return list;
}
}

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

Loading…
Cancel
Save