Browse Source

Merge branch 'dev' into feature/dashboard

# Conflicts:
#	pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java
tags/24080901
niohe·erbao 1 year ago
parent
commit
984c8e2699
91 changed files with 2826 additions and 232 deletions
  1. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java
  3. +6
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java
  4. +6
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJNAction.java
  5. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJYAction.java
  6. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareKFBAction.java
  7. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLDAction.java
  8. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLQAction.java
  9. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQTAction.java
  10. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQYAction.java
  11. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSBJAction.java
  12. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSCAction.java
  13. +7
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSYAction.java
  14. +6
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java
  15. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java
  16. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java
  17. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java
  18. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java
  19. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java
  20. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java
  21. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java
  22. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java
  23. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java
  24. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java
  25. +8
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java
  26. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java
  27. +31
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java
  28. +30
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java
  29. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/EvalObjectEnum.java
  30. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java
  31. +46
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java
  32. +353
    -52
      pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java
  33. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AddAppraisalObjectDTO.java
  34. +13
    -27
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java
  35. +11
    -22
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java
  36. +10
    -16
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java
  37. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java
  38. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java
  39. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java
  40. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java
  41. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java
  42. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java
  43. +16
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java
  44. +12
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java
  45. +6
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java
  46. +64
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java
  47. +199
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java
  48. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java
  49. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java
  50. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java
  51. +31
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java
  52. +40
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java
  53. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java
  54. +25
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java
  55. +40
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java
  56. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java
  57. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java
  58. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java
  59. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java
  60. +0
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java
  61. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  62. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java
  63. +0
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java
  64. +86
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java
  65. +31
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  66. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java
  67. +65
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/controller/SafetyRiskController.java
  68. +218
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java
  69. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/PersonSafetyInfoMapper.java
  70. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/SupplierSafetyQualificationMapper.java
  71. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/PersonSafetyInfoDTO.java
  72. +36
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/SupplierSafetyQualificationDTO.java
  73. +48
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/PersonSafetyInfo.java
  74. +45
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/SupplierSafetyQualification.java
  75. +43
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/PersonSafetyInfoVO.java
  76. +78
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/ProjectMonitorVO.java
  77. +23
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SafetyMonitorVO.java
  78. +43
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SupplierSafetyQualificationVO.java
  79. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/service/IPersonSafetyInfoService.java
  80. +14
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/service/ISupplierSafetyQualificationService.java
  81. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/PersonSafetyInfoServiceImpl.java
  82. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/SupplierSafetyQualificationServiceImpl.java
  83. +142
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java
  84. +56
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java
  85. +17
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/EarlyWarningRecordsMapper.java
  86. +108
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java
  87. +35
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java
  88. +128
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java
  89. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java
  90. +61
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java
  91. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java View File

@@ -58,6 +58,11 @@ public interface CommonConst {
Integer VERSION_JUDGE = -1;

String COPY = "副本";
String PROJECT_REPEAT = " 项目已在其他评价计划中,请勿重复添加!";
String APP_REPEAT = " 应用已在其他评价计划中,请勿重复添加!";
Integer REAPPRAISAL_TYPE = 1;
Integer VERIFY_TYPE = 2;
String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!";





+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java View File

@@ -31,6 +31,9 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
"com.ningdatech.pmapi.filemanage.controller",
"com.ningdatech.pmapi.performance.controller",
"com.ningdatech.pmapi.irs.controller",
"com.ningdatech.pmapi.safety.controller",
"com.ningdatech.pmapi.portrait.controller"
"com.ningdatech.pmapi.irs.controller",
"com.ningdatech.pmapi.dashboard.controller"
})
public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {


+ 6
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java View File

@@ -209,9 +209,14 @@ public class ProjectDeclareAction {
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 6
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJNAction.java View File

@@ -206,9 +206,14 @@ public class ProjectDeclareJNAction {
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJYAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareJYAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareKFBAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareKFBAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLDAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareLDAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLQAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareLQAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQTAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareQTAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQYAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareQYAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSBJAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareSBJAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSCAction.java View File

@@ -212,10 +212,15 @@ public class ProjectDeclareSCAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 7
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSYAction.java View File

@@ -204,10 +204,15 @@ public class ProjectDeclareSYAction {
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode());
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}

@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 6
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java View File

@@ -205,9 +205,14 @@ public class ProjectDeclareYHAction {
}


@OnTransition(source = "TO_BE_PURCHASED", target = "UNDER_CONSTRUCTION")
@OnTransition(source = "TO_BE_PURCHASED", target = "OPERATION")
public void PURCHASE_PUT_ON_RECORD(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.OPERATION.getCode());
}
@OnTransition(source = "OPERATION", target = "UNDER_CONSTRUCTION")
public void START_TO_WORK(Message<ProjectStatusChangeEvent> message) {
Project project = (Project) message.getHeaders().get(PROJECT_DECLARE);
project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode());
}



+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineJNBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineJYBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineKFQBuilder implements ProjectDeclareState
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineLDBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java View File

@@ -212,11 +212,17 @@ public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineQTBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineQYBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java View File

@@ -212,11 +212,17 @@ public class ProjectDeclareStateMachineSBJBuilder implements ProjectDeclareState
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java View File

@@ -221,11 +221,17 @@ public class ProjectDeclareStateMachineSCBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APP_REGISTER)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.REGISTER_APP).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineSYBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 8
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java View File

@@ -211,11 +211,17 @@ public class ProjectDeclareStateMachineYHBuilder implements ProjectDeclareStateM
.source(ProjectStatusEnum.TO_BE_APPROVED)
.target(ProjectStatusEnum.TO_BE_PURCHASED)
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and()
// 待采购采购备案,从待采购到建设
// 待采购采购备案,从待采购到实施
.withExternal()
.source(ProjectStatusEnum.TO_BE_PURCHASED)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.target(ProjectStatusEnum.OPERATION)
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and()

// 待开工 实施,从实施到建设中
.withExternal()
.source(ProjectStatusEnum.OPERATION)
.target(ProjectStatusEnum.UNDER_CONSTRUCTION)
.event(ProjectStatusChangeEvent.START_TO_WORK).and()
// 建设中初验备案,从建设中到待终验
.withExternal()
.source(ProjectStatusEnum.UNDER_CONSTRUCTION)


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java View File

@@ -22,6 +22,7 @@ public class ApiApplySearchResult implements Serializable {
private String type;
private String status;
private String sysStateTime;
private String systemAreas;
private String deptName;
private String deptCode;
private String fiveAreas;


+ 31
- 2
pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java View File

@@ -3,11 +3,14 @@ package com.ningdatech.pmapi.performance.controller;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.performance.manage.PerformanceAppraisalPlanManage;
import com.ningdatech.pmapi.performance.model.dto.AddAppraisalObjectDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectGroupVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -32,13 +35,13 @@ public class PerformanceAppraisalPlanController {
private final PerformanceAppraisalPlanManage performanceAppraisalPlanManage;

@GetMapping("/list")
@ApiOperation("绩效评价列表")
@ApiOperation("评价计划列表")
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
return performanceAppraisalPlanManage.list(req);
}

@GetMapping("/detail/{id}")
@ApiOperation("绩效评价列表")
@ApiOperation("评价计划详情")
public PerformanceAppraisalVO detail(@PathVariable Long id) {
return performanceAppraisalPlanManage.detail(id);
}
@@ -50,6 +53,20 @@ public class PerformanceAppraisalPlanController {
return performanceAppraisalPlanManage.create(createDTO);
}

@PostMapping("/addProject")
@ApiOperation("评价计划-添加待评价项目")
@WebLog("评价计划-添加待评价项目")
public String addProject(@Valid @RequestBody AddAppraisalObjectDTO addDTO) {
return performanceAppraisalPlanManage.addProject(addDTO);
}

@PostMapping("/addApplication")
@ApiOperation("评价计划-添加待评价应用")
@WebLog("评价计划-添加待评价应用")
public String addApplication(@Valid @RequestBody AddAppraisalObjectDTO addDTO) {
return performanceAppraisalPlanManage.addApplication(addDTO);
}

@PostMapping("/edit")
@ApiOperation("编辑绩效评价")
@WebLog("编辑绩效评价")
@@ -64,6 +81,18 @@ public class PerformanceAppraisalPlanController {
return performanceAppraisalPlanManage.delete(id);
}

@GetMapping("/application-list")
@ApiOperation("待添加应用列表")
public PageVo<PerformanceAppraisalApplicationVO> applicationList(PerformanceAppraisalListReq req) {
return performanceAppraisalPlanManage.applicationList(req);
}

@GetMapping("/project-list")
@ApiOperation("项目分组-评价计划内待评价项目列表")
public PageVo<PerformanceAppraisalProjectVO> projectList(PerformanceAppraisalListReq req) {
return performanceAppraisalPlanManage.projectList(req);
}

@GetMapping("/group/list/{appraisalId}")
@ApiOperation("绩效评价分组列表")
public List<PerformanceAppraisalProjectGroupVO> groupList(@PathVariable Long appraisalId,


+ 30
- 6
pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java View File

@@ -1,6 +1,14 @@
package com.ningdatech.pmapi.performance.convert;

import cn.hutool.core.collection.CollUtil;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;

import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO;
@@ -8,10 +16,8 @@ import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import org.apache.commons.lang3.StringUtils;

import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;

/**
* @Classname PerformanceAppraisalConverer
@@ -27,6 +33,7 @@ public class PerformanceAppraisalConveter {
return projects.stream().map(p -> {
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO();
vo.setIsReAppraisal(p.getIsReAppraisal());
vo.setCanSelfAppraisal(checkCanSelfAppraisal(p));
vo.setId(p.getProjectId());
if(map.containsKey(p.getProjectCode())){
Project project = map.get(p.getProjectCode());
@@ -45,17 +52,18 @@ public class PerformanceAppraisalConveter {
}

public static List<PerformanceAppraisalApplicationVO> convertApplications(
List<PerformanceAppraisalApplication> applications, Map<Long, ProjectApplication> map) {
List<PerformanceAppraisalApplication> applications, Map<Long,ProjectApplication> map) {
if(CollUtil.isNotEmpty(applications) && CollUtil.isNotEmpty(map)){
return applications.stream().map(a -> {
PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO();
vo.setId(a.getApplicationId());
vo.setAppId(a.getApplicationId());
if(map.containsKey(a.getApplicationId())){
ProjectApplication application = map.get(a.getApplicationId());
vo.setApplicationName(StringUtils.isNotBlank(application.getApplicationName())?
application.getApplicationName() : application.getAccountAppName());
vo.setApplicationType(application.getApplicationType());
vo.setBizDomain(application.getBizDomain());
vo.setBuildOrgName(application.getBuildOrgName());
vo.setPublishSide(application.getPublishSide());
}
return vo;
@@ -70,4 +78,20 @@ public class PerformanceAppraisalConveter {
}
return StringUtils.EMPTY;
}

/**
* 是否可以自评
* @param appraisalProject
* @return
*/
public static Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) {
if (Objects.nonNull(appraisalProject.getSelfAppraisalStart())
&& Objects.nonNull(appraisalProject.getSelfAppraisalEnd())) {
if (LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 &&
LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
}

+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/EvalObjectEnum.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.pmapi.performance.enumration;

import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
* EvalObjectEnum
* @return
* @author CMM
* @since 2023/07/26 16:44
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum EvalObjectEnum {
/**
* 评价对象
*/
PROJECT("1", "项目"),
APP("2", "应用"),
PROJECT_APP("1,2", "项目、应用");

private String code;
private String desc;

public static String getDesc(String code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (EvalObjectEnum t : EvalObjectEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}
}

+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java View File

@@ -22,7 +22,6 @@ public enum PerformanceTemplateTypeEnum {
/**
* 模板类型
*/
//STAGE(0, "阶段"),
FIRST_INDEX(1, "第一指标"),
SECOND_INDEX(2, "第二指标"),
THIRD_INDEX(3, "第三指标");


+ 46
- 18
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java View File

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal;
@@ -15,9 +16,14 @@ import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplicationService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.sys.service.IRoleService;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
@@ -49,6 +55,7 @@ public class OrgSelfAppraisalManage {
private final IProjectService projectService;

private final IProjectApplicationService applicationService;
private final IRoleService roleService;

/**
* 绩效列表
@@ -60,36 +67,49 @@ public class OrgSelfAppraisalManage {

//当前登录用户 单位code
String empPosUnitCode = user.getEmpPosUnitCode();
// 获取当前登录用户的角色列表,只有单位管理员才能查看该列表
List<Role> userRoleList = user.getUserRoleList();
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList());
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class)
.eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc()));
if (Objects.isNull(role)){
throw new BizException("系统没有单位管理员角色!");
}

// 登录用户不是单位管理员,不能查看本单位的自评计划列表
if (!roleIdList.contains(role.getId())){
return PageVo.empty();
}

// 获取登录用户所在单位的所有已终验项目信息
List<Project> projectLists = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode())
.eq(Project::getBuildOrgCode, empPosUnitCode));

if(CollUtil.isEmpty(projectLists)){
return PageVo.empty();
}

List<Long> projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList());

// 获取添加过该单位项目的所有评价计划信息
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.in(PerformanceAppraisalProject::getProjectId, projectIds));
if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}

Set<Long> paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet());
// 获取评价计划列表
Page<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class)
.in(PerformanceAppraisal::getId,paIds)
.orderByDesc(PerformanceAppraisal::getUpdateOn);
.in(PerformanceAppraisal::getId,paIds)
.orderByDesc(PerformanceAppraisal::getUpdateOn);
performanceAppraisalService.page(page,wrapper);
if(0L == page.getTotal()){
return PageVo.empty();
}

List<PerformanceAppraisalVO> res = page.getRecords().stream().map(p -> {
PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class);
return vo;
}).collect(Collectors.toList());
List<PerformanceAppraisalVO> res = page.getRecords().stream()
.map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class))
.collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

@@ -97,19 +117,22 @@ public class OrgSelfAppraisalManage {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

PerformanceAppraisal plan = performanceAppraisalService.getById(planId);
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该计划不存在!");
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!");

// 获取评价计划内已添加的待评价项目信息
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()));
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p));

if(CollUtil.isEmpty(paps)){
return PageVo.empty();
}
Set<String> projectIds = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet());

// 获取本单位在当前评价计划内的项目
Set<String> projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet());
Page<Project> page = req.page();
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, projectIds)
.in(Project::getProjectCode, projectCodes)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode())
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName());
@@ -122,7 +145,12 @@ public class OrgSelfAppraisalManage {
List<PerformanceAppraisalProjectVO> res = page.getRecords().stream()
.map(p -> {
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class);
vo.setCanSelfAppraisal(checkCanSelfAppraisal(plan));
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId());
vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType()));
vo.setIsReAppraisal(appraisalProject.getIsReAppraisal());
vo.setSelfAppraisalStart(appraisalProject.getSelfAppraisalStart());
vo.setSelfAppraisalEnd(appraisalProject.getSelfAppraisalEnd());
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject));
return vo;
})
.collect(Collectors.toList());
@@ -142,12 +170,12 @@ public class OrgSelfAppraisalManage {

/**
* 是否可以自评
* @param plan
* @param appraisalProject
* @return
*/
private Boolean checkCanSelfAppraisal(PerformanceAppraisal plan) {
if(LocalDateTime.now().compareTo(plan.getSelfAppraisalStart()) > 0 &&
LocalDateTime.now().compareTo(plan.getSelfAppraisalEnd()) < 0){
private Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) {
if(LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 &&
LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0){
return Boolean.TRUE;
}
return Boolean.FALSE;


+ 353
- 52
pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java View File

@@ -1,30 +1,38 @@
package com.ningdatech.pmapi.performance.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.common.util.CodeUtil;
import com.ningdatech.pmapi.performance.convert.PerformanceAppraisalConveter;
import com.ningdatech.pmapi.performance.model.dto.AppraisalProjectDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalCreateDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalEditDTO;
import com.ningdatech.pmapi.performance.model.dto.PerformanceAppraisalProjectGroupSaveDTO;
import com.ningdatech.pmapi.performance.enumration.EvalObjectEnum;
import com.ningdatech.pmapi.performance.model.dto.*;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisal;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalApplication;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject;
import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProjectGroup;
import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalApplicationVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectGroupVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO;
@@ -32,20 +40,28 @@ import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalApplication
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectGroupService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalProjectService;
import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalService;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.workflow.bean.process.ProgressNode;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.service.ProcessInstanceService;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

/**
* @Classname PerformanceAppraisalManage
@@ -59,18 +75,15 @@ import java.util.stream.Collectors;
public class PerformanceAppraisalPlanManage {

private final IPerformanceAppraisalService performanceAppraisalService;

private final IPerformanceAppraisalProjectService performanceAppraisalProjectService;

private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService;

private final IProjectService projectService;

private final IProjectApplicationService applicationService;

private final IPerformanceAppraisalProjectGroupService groupService;

private final UserInfoHelper userInfoHelper;
private final IProjectInstService projectInstService;
private final ProcessInstanceService processInstanceService;
private final BuildUserUtils buildUserUtils;

/**
* 绩效列表
@@ -78,12 +91,15 @@ public class PerformanceAppraisalPlanManage {
* @return
*/
public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
String regionCode = userDetail.getRegionCode();
Page<PerformanceAppraisal> page = req.page();
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class)
.like(StringUtils.isNotBlank(req.getPlanName()),PerformanceAppraisal::getName,req.getPlanName())
.ge(Objects.nonNull(req.getStart()),PerformanceAppraisal::getCreateOn,req.getStart())
.le(Objects.nonNull(req.getEnd()),PerformanceAppraisal::getCreateOn,req.getEnd())
.orderByDesc(PerformanceAppraisal::getUpdateOn);
.like(StringUtils.isNotBlank(req.getPlanName()),PerformanceAppraisal::getName,req.getPlanName())
.ge(Objects.nonNull(req.getStart()),PerformanceAppraisal::getCreateOn,req.getStart())
.le(Objects.nonNull(req.getEnd()),PerformanceAppraisal::getCreateOn,req.getEnd())
.eq(PerformanceAppraisal::getRegionCode,regionCode)
.orderByDesc(PerformanceAppraisal::getUpdateOn);
performanceAppraisalService.page(page,wrapper);
if(0L == page.getTotal()){
return PageVo.empty();
@@ -188,6 +204,31 @@ public class PerformanceAppraisalPlanManage {
if(finalPaasGroupMap.containsKey(vo.getId())){
vo.setApplications(PerformanceAppraisalConveter.convertApplications(finalPaasGroupMap.get(vo.getId()),finalApplicationMap));
}

// 评价计划关联的分组信息
List<PerformanceAppraisalProjectGroup> groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class)
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, id));
// 对计划内待评价项目进行了分组
if (CollUtil.isNotEmpty(groupList)){
// 获取分组信息
List<PerformanceAppraisalProjectGroupVO> groups = groupList.stream().map(g -> {
PerformanceAppraisalProjectGroupVO groupVo = new PerformanceAppraisalProjectGroupVO();
groupVo.setId(g.getId());
groupVo.setAppraisalId(id);
groupVo.setName(g.getName());
String reAppraisalUsersStr = g.getReAppraisalUsers();
List<UserFullInfoDTO> reAppraisalUsers = Arrays.stream(reAppraisalUsersStr.split(StrPool.COMMA))
.map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList());
groupVo.setReAppraisalUsers(reAppraisalUsers);
String verificationUsersStr = g.getVerificationUsers();
List<UserFullInfoDTO> verificationUsers = Arrays.stream(verificationUsersStr.split(StrPool.COMMA))
.map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList());
groupVo.setVerificationUsers(verificationUsers);
groupVo.setCreateOn(g.getCreateOn());
return groupVo;
}).collect(Collectors.toList());
vo.setGroups(groups);
}
return vo;
}

@@ -199,25 +240,27 @@ public class PerformanceAppraisalPlanManage {
@Transactional
public String create(PerformanceAppraisalCreateDTO createDTO) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
// 计划名称重复校验
deduplicationName(createDTO);

PerformanceAppraisal pa = BeanUtil.copyProperties(createDTO,PerformanceAppraisal.class);


pa.setCreateOn(LocalDateTime.now());
pa.setCreateBy(user.getUsername());
pa.setUpdateOn(LocalDateTime.now());
pa.setUpdateBy(user.getUsername());
pa.setRegionCode(user.getRegionCode());
performanceAppraisalService.save(pa);

if(CollUtil.isNotEmpty(createDTO.getProjects())
&& StringUtils.isNotBlank(createDTO.getTarget())
&& createDTO.getTarget().contains("1")){
&& createDTO.getTarget().contains(EvalObjectEnum.PROJECT.getCode())){
saveProjects(createDTO,pa.getId(),user);
}

if(CollUtil.isNotEmpty(createDTO.getApplicationIds())
&& StringUtils.isNotBlank(createDTO.getTarget())
&& createDTO.getTarget().contains("2")){
&& createDTO.getTarget().contains(EvalObjectEnum.APP.getCode())){
saveApplications(createDTO,pa.getId(),user);
}

@@ -278,11 +321,16 @@ public class PerformanceAppraisalPlanManage {
return;
}

Integer startSelfDays = createDTO.getStartSelfDays();
Integer completeSelfDays = createDTO.getCompleteSelfDays();
List<AppraisalProjectDTO> projects = createDTO.getProjects();

for(AppraisalProjectDTO appraisalProject : projects){
Project newProject = projectService.getNewProject(appraisalProject.getId());
VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId());
// 获取项目终验完成的时间
LocalDateTime finishTime = getProjectFinishTime(newProject);

PerformanceAppraisalProject pap = new PerformanceAppraisalProject();
pap.setAppraisalId(id);
pap.setProjectId(appraisalProject.getId());
@@ -292,10 +340,44 @@ public class PerformanceAppraisalPlanManage {
pap.setCreateOn(LocalDateTime.now());
pap.setUpdateBy(user.getUsername());
pap.setUpdateOn(LocalDateTime.now());
LocalDateTime selfAppraisalStart = finishTime.plusDays(startSelfDays);
pap.setSelfAppraisalStart(selfAppraisalStart);
long days = startSelfDays + completeSelfDays;
LocalDateTime selfAppraisalEnd = finishTime.plusDays(days);
pap.setSelfAppraisalEnd(selfAppraisalEnd);
performanceAppraisalProjectService.save(pap);
}
}

private LocalDateTime getProjectFinishTime(Project newProject) {
//查出历史版本的 所有项目ID
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(newProject);
// 根据项目ID查询出项目终验流程的流程状态
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, allVersionProjectIds)
.eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode())
.orderByDesc(ProjectInst::getCreatOn)
.last(BizConst.LIMIT_1));

if (Objects.isNull(projectInst)){
throw new BizException("未获取到项目终验审批流程信息!");
}

LocalDateTime finishTime;
String instCode = projectInst.getInstCode();
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode);
// 装配节点审核人员信息
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo();
if (CollUtil.isNotEmpty(progressInfo)) {
buildUserUtils.buildUserByProcessInfo(progressInfo);
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1);
finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime());
}else {
finishTime = NdDateUtils.date2LocalDateTime(instanceDetail.getStartTime());
}
return finishTime;
}

@Transactional
public void saveApplications(PerformanceAppraisalCreateDTO createDTO,Long id,UserInfoDetails user) {
if(CollUtil.isEmpty(createDTO.getApplicationIds())){
@@ -303,10 +385,7 @@ public class PerformanceAppraisalPlanManage {
}

List<Long> applicationIds = createDTO.getApplicationIds();

for(Long applicationId : applicationIds){
ProjectApplication projectApplication = applicationService.getById(applicationId);
VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在 " + applicationId);
PerformanceAppraisalApplication paa = new PerformanceAppraisalApplication();
paa.setAppraisalId(id);
paa.setApplicationId(applicationId);
@@ -327,10 +406,14 @@ public class PerformanceAppraisalPlanManage {
//删除先
performanceAppraisalProjectService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId,editDTO.getId()));
Integer startSelfDays = editDTO.getStartSelfDays();
Integer completeSelfDays = editDTO.getCompleteSelfDays();
List<AppraisalProjectDTO> projects = editDTO.getProjects();
for(AppraisalProjectDTO appraisalProject : projects){
Project newProject = projectService.getNewProject(appraisalProject.getId());
VUtils.isTrue(Objects.isNull(newProject)).throwMessage("项目不存在 " + appraisalProject.getId());
// 获取项目终验完成的时间
LocalDateTime finishTime = getProjectFinishTime(newProject);
PerformanceAppraisalProject pap = new PerformanceAppraisalProject();
pap.setAppraisalId(editDTO.getId());
pap.setProjectId(appraisalProject.getId());
@@ -340,6 +423,11 @@ public class PerformanceAppraisalPlanManage {
pap.setCreateOn(LocalDateTime.now());
pap.setUpdateBy(user.getUsername());
pap.setUpdateOn(LocalDateTime.now());
LocalDateTime selfAppraisalStart = finishTime.plusDays(startSelfDays);
pap.setSelfAppraisalStart(selfAppraisalStart);
long days = startSelfDays + completeSelfDays;
LocalDateTime selfAppraisalEnd = finishTime.plusDays(days);
pap.setSelfAppraisalEnd(selfAppraisalEnd);
performanceAppraisalProjectService.save(pap);
}
}
@@ -379,12 +467,17 @@ public class PerformanceAppraisalPlanManage {
PerformanceAppraisal pa = performanceAppraisalService.getById(id);
VUtils.isTrue(Objects.isNull(pa)).throwMessage("绩效评价不存在 删除失败!");

//如果到了自评就不能删除了
if(pa.getSelfAppraisalStart().compareTo(LocalDateTime.now()) < 0){
throw new BizException("自评已经开始 不能够删除绩效评价");
}

if(performanceAppraisalService.removeById(id)){
// 删除评价计划关联的项目
//绩效关联的项目
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, id));
performanceAppraisalProjectService.removeBatchByIds(paps);
// 删除评价计划关联的应用
//绩效关联的应用
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class)
.eq(PerformanceAppraisalApplication::getAppraisalId, id));
performanceAppraisalApplicationService.removeBatchByIds(paas);
return "删除成功";
}
return "删除失败";
@@ -393,8 +486,9 @@ public class PerformanceAppraisalPlanManage {
public List<PerformanceAppraisalProjectGroupVO> groupList(Long appraisalId,String name) {
List<PerformanceAppraisalProjectGroup> groups = groupService.list(
Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class)
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId)
.like(StringUtils.isNotBlank(name),PerformanceAppraisalProjectGroup::getName,name));
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, appraisalId)
.like(StringUtils.isNotBlank(name),PerformanceAppraisalProjectGroup::getName,name)
.orderByDesc(PerformanceAppraisalProjectGroup::getCreateOn));
if(CollUtil.isEmpty(groups)){
return Collections.emptyList();
}
@@ -406,7 +500,7 @@ public class PerformanceAppraisalPlanManage {
groups.stream().forEach(g -> {
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getReAppraisalUsers()));
allEmployeeCodes.addAll(CodeUtil.convertStrToList(g.getVerificationUsers()));
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectIds()));
projectCodes.addAll(CodeUtil.convertStrToList(g.getProjectCodes()));
});

if(CollUtil.isNotEmpty(allEmployeeCodes)){
@@ -436,7 +530,7 @@ public class PerformanceAppraisalPlanManage {
vo.setUpdateBy(g.getUpdateBy());
vo.setUpdateOn(g.getUpdateOn());
vo.setId(g.getId());
vo.setProjects(checkProject(g.getProjectIds(), finalProjectMap));
vo.setProjects(checkProject(g.getProjectCodes(), finalProjectMap));
vo.setReAppraisalUsers(checkUser(g.getReAppraisalUsers(), finalUserMap));
vo.setVerificationUsers(checkUser(g.getVerificationUsers(), finalUserMap));
return vo;
@@ -457,8 +551,8 @@ public class PerformanceAppraisalPlanManage {

Map<String, Project> projectMap = Maps.newHashMap();
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.in(StringUtils.isNotBlank(group.getProjectIds()),Project::getProjectCode,
Arrays.stream(group.getProjectIds().split(StrPool.COMMA)).collect(Collectors.toList()))
.in(StringUtils.isNotBlank(group.getProjectCodes()),Project::getProjectCode,
Arrays.stream(group.getProjectCodes().split(StrPool.COMMA)).collect(Collectors.toList()))
.eq(Project::getNewest,Boolean.TRUE));
if(CollUtil.isNotEmpty(projects)){
projectMap = projects.stream().collect(Collectors.toMap(Project::getProjectCode,p -> p));
@@ -483,7 +577,7 @@ public class PerformanceAppraisalPlanManage {
vo.setUpdateBy(group.getUpdateBy());
vo.setUpdateOn(group.getUpdateOn());
vo.setId(group.getId());
vo.setProjects(checkProject(group.getProjectIds(), projectMap));
vo.setProjects(checkProject(group.getProjectCodes(), projectMap));
vo.setReAppraisalUsers(checkUser(group.getReAppraisalUsers(), userMap));
vo.setVerificationUsers(checkUser(group.getVerificationUsers(), userMap));
return vo;
@@ -498,7 +592,9 @@ public class PerformanceAppraisalPlanManage {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

PerformanceAppraisalProjectGroup group = BeanUtil.copyProperties(dto, PerformanceAppraisalProjectGroup.class);

// 获取当前评价计划内的分组信息
List<PerformanceAppraisalProjectGroup> groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class)
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, dto.getAppraisalId()));
if(Objects.isNull(dto.getId())){
group.setId(null);
group.setCreateOn(LocalDateTime.now());
@@ -509,13 +605,31 @@ public class PerformanceAppraisalPlanManage {
group.setId(old.getId());
}
if(CollUtil.isNotEmpty(dto.getProjectCodes())){
group.setProjectIds(dto.getProjectCodes().stream().collect(Collectors.joining(StrPool.COMMA)));
// 判断选择的项目是否已经在当前评价计划的其他分组内
// 获取当前评价计划的其他分组的项目信息
List<String> projectCodeList = groupList.stream()
.map(PerformanceAppraisalProjectGroup::getProjectCodes)
.collect(Collectors.toList());
checkProjectCodes(dto.getProjectCodes(),projectCodeList);
group.setProjectCodes(String.join(StrPool.COMMA, dto.getProjectCodes()));
}
if(CollUtil.isNotEmpty(dto.getReAppraisalUsers())){
group.setReAppraisalUsers(dto.getReAppraisalUsers().stream().collect(Collectors.joining(StrPool.COMMA)));
// 判断选择的复评人员是否已经在当前评价计划的其他分组内
// 获取当前评价计划的其他分组的复评人员信息
List<String> reUserList = groupList.stream()
.map(PerformanceAppraisalProjectGroup::getReAppraisalUsers)
.collect(Collectors.toList());
checkReAppraisalAndVerifyUsers(dto.getReAppraisalUsers(),reUserList,CommonConst.REAPPRAISAL_TYPE);
group.setReAppraisalUsers(String.join(StrPool.COMMA, dto.getReAppraisalUsers()));
}
if(CollUtil.isNotEmpty(dto.getVerificationUsers())){
group.setVerificationUsers(dto.getVerificationUsers().stream().collect(Collectors.joining(StrPool.COMMA)));
// 判断选择的核查人员是否已经在当前评价计划的其他分组内
// 获取当前评价计划的其他分组的核查人员信息
List<String> verifyList = groupList.stream()
.map(PerformanceAppraisalProjectGroup::getVerificationUsers)
.collect(Collectors.toList());
checkReAppraisalAndVerifyUsers(dto.getVerificationUsers(),verifyList,CommonConst.VERIFY_TYPE);
group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers()));
}
group.setUpdateOn(LocalDateTime.now());
group.setUpdateBy(user.getUsername());
@@ -523,6 +637,45 @@ public class PerformanceAppraisalPlanManage {
return "操作成功";
}

private void checkProjectCodes(List<String> projectCodes, List<String> projectCodeList) {
// 判断选择的项目是否已经在当前评价计划的其他分组内
// 如果提交的项目在该评价计划其他分组中
if (!CollectionUtil.intersection(projectCodes,projectCodeList).isEmpty()){
ArrayList<String> proCodes = Lists.newArrayList(projectCodes);
proCodes.retainAll(projectCodeList);
// 获取重复添加的项目Code
String names = proCodes.stream().map(i -> {
Project project = projectService.getProjectByCode(i);
if (Objects.nonNull(project)){
return project.getProjectName();
}
return StrPool.EMPTY;
}).collect(Collectors.joining(StrPool.COMMA));
throw new BizException("项目:" + names + CommonConst.REPEAT);
}
}

private void checkReAppraisalAndVerifyUsers(List<String> checkUsers, List<String> compareUsers, Integer type) {
// 如果提交的复评/核查人员在该评价计划其他分组中
if (!CollectionUtil.intersection(checkUsers,compareUsers).isEmpty()){
ArrayList<String> reUsers = Lists.newArrayList(checkUsers);
reUsers.retainAll(compareUsers);
// 获取重复添加的复评/核查人员名字
String names = reUsers.stream().map(i -> {
UserFullInfoDTO info = userInfoHelper.getUserFullInfoByEmployeeCode(i);
if (Objects.nonNull(info)){
return info.getUsername();
}
return StrPool.EMPTY;
}).collect(Collectors.joining(StrPool.COMMA));
if (CommonConst.REAPPRAISAL_TYPE.equals(type)) {
throw new BizException("复评人员:" + names + CommonConst.REPEAT);
}else if (CommonConst.VERIFY_TYPE.equals(type)){
throw new BizException("核查人员:" + names + CommonConst.REPEAT);
}
}
}

/**
* 删除分组
* @param id
@@ -538,11 +691,6 @@ public class PerformanceAppraisalPlanManage {
PerformanceAppraisal pa = performanceAppraisalService.getById(appraisalId);
VUtils.isTrue(Objects.isNull(pa)).throwMessage("评价不存在");

//如果到了自评就不能删除了
if(pa.getSelfAppraisalStart().compareTo(LocalDateTime.now()) < 0){
throw new BizException("自评已经开始 不能够删除绩效评价");
}

if(groupService.removeById(id)){
return "删除成功";
}
@@ -557,6 +705,7 @@ public class PerformanceAppraisalPlanManage {
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO();
if(projectMap.containsKey(projectCode)){
Project project = projectMap.get(projectCode);
vo.setProjectName(project.getProjectName());
vo.setProjectTypeName(BizUtils.getProjectTypeName(project.getProjectType()));
vo.setProjectType(project.getProjectType());
vo.setId(project.getId());
@@ -572,8 +721,160 @@ public class PerformanceAppraisalPlanManage {
if(StringUtils.isBlank(users)){
return Collections.emptyList();
}
return Arrays.stream(users.split(StrPool.COMMA)).map(
employeeCode -> userMap.get(employeeCode)
).collect(Collectors.toList());
return Arrays.stream(users.split(StrPool.COMMA)).map(userMap::get).collect(Collectors.toList());
}

public PageVo<PerformanceAppraisalApplicationVO> applicationList(PerformanceAppraisalListReq req) {
Page<ProjectApplication> page = req.page();
// 获取登录用户所在区域已验收项目
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String regionCode = user.getRegionCode();
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getAreaCode,regionCode)
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode())
.eq(Project::getNewest, Boolean.TRUE));
// 获取已验收项目关联的应用信息
List<Integer> projectVersions = projects.stream().map(Project::getVersion).collect(Collectors.toList());
List<String> projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList());
LambdaQueryWrapper<ProjectApplication> wrapper = Wrappers.lambdaQuery(ProjectApplication.class)
.like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName())
.like(StringUtils.isNotBlank(req.getBuildOrgName()),ProjectApplication::getBuildOrgName,req.getBuildOrgName())
.in(ProjectApplication::getProjectCode,projectCodes)
.in(ProjectApplication::getProjectVersion,projectVersions)
.orderByDesc(ProjectApplication::getCreateOn);
applicationService.page(page,wrapper);
if(0L == page.getTotal()){
return PageVo.empty();
}
List<PerformanceAppraisalApplicationVO> res = page.getRecords().stream().map(r -> {
PerformanceAppraisalApplicationVO vo = new PerformanceAppraisalApplicationVO();
vo.setAppId(r.getId());
vo.setApplicationName(Objects.nonNull(r.getApplicationName()) ? r.getApplicationName() : r.getRelatedExistsApplication());
vo.setBuildOrgName(r.getBuildOrgName());
vo.setApplicationType(r.getApplicationType());
vo.setBizDomain(r.getBizDomain());
vo.setPublishSide(r.getPublishSide());
return vo;
}).collect(Collectors.toList());
return PageVo.of(res,page.getTotal());
}

public String addProject(AddAppraisalObjectDTO addDTO) {
List<Long> projectIdList = addDTO.getProjectIds();
if (CollUtil.isEmpty(projectIdList)){
throw new BizException("请选择至少一个评价项目!");
}
// 获取已经创建的评价计划中添加的评价项目ID
List<Long> projectIds = performanceAppraisalProjectService.list().stream()
.map(PerformanceAppraisalProject::getProjectId).collect(Collectors.toList());
Long appraisalId = addDTO.getAppraisalId();
// 如果评价计划不为空,说明是编辑评价计划,
// 评价计划中原来已经勾选的待评价项目,不作为判断重复添加的内容
if (Objects.nonNull(appraisalId)){
// 获取当前编辑的评价计划中选择的项目
List<Long> proIds = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)).stream()
.map(PerformanceAppraisalProject::getProjectId).collect(Collectors.toList());
// 去除这些项目
projectIds.removeAll(proIds);
}
// 如果有交集,说明选择的项目中,有已经在其他评价计划中的项目
if (Boolean.TRUE.equals(haveIntersection(projectIdList, projectIds))){
// 得到交集
List<Long> intersection = Lists.newArrayList(projectIdList);
intersection.retainAll(projectIds);
// 获取重复添加的项目名称
String names = intersection.stream().map(i -> {
Project project = projectService.getById(i);
if (Objects.nonNull(project)) {
return project.getProjectName();
}
return StrPool.EMPTY;
}).collect(Collectors.joining(StrPool.COMMA));
throw new BizException(names + CommonConst.PROJECT_REPEAT);
}
return "添加成功";
}


public String addApplication(AddAppraisalObjectDTO addDTO) {
List<Long> applicationIdList = addDTO.getApplicationIds();
if (CollUtil.isEmpty(applicationIdList)){
throw new BizException("请选择至少一个评应用!");
}
// 获取已经创建的评价计划中添加的评价应用ID
List<Long> applicationIds = performanceAppraisalApplicationService.list().stream()
.map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList());
Long appraisalId = addDTO.getAppraisalId();
// 如果评价计划不为空,说明是编辑评价计划,
// 评价计划中原来已经勾选的待评价应用,不作为判断重复添加的内容
if (Objects.nonNull(appraisalId)){
// 获取当前编辑的评价计划中选择的应用
List<Long> appIds = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class)
.eq(PerformanceAppraisalApplication::getAppraisalId, appraisalId)).stream()
.map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList());
// 去除这些应用
applicationIds.removeAll(appIds);
}
// 如果有交集,说明选择的应用中,有已经在其他评价计划中的应用
if (Boolean.TRUE.equals(haveIntersection(applicationIdList, applicationIds))){
// 得到交集
List<Long> intersection = Lists.newArrayList(applicationIdList);
intersection.retainAll(applicationIds);
// 获取重复添加的应用名称
String names = intersection.stream().map(i -> {
ProjectApplication application = applicationService.getById(i);
if (Objects.nonNull(application)) {
return Objects.nonNull(application.getApplicationName()) ? application.getApplicationName()
: application.getRelatedExistsApplication();
}
return StrPool.EMPTY;
}).collect(Collectors.joining(StrPool.COMMA));
throw new BizException(names + CommonConst.APP_REPEAT);
}
return "添加成功";
}

private Boolean haveIntersection(List<Long> idList, List<Long> ids) {
return !CollectionUtil.intersection(idList, ids).isEmpty();
}

public PageVo<PerformanceAppraisalProjectVO> projectList(PerformanceAppraisalListReq req) {
Long appraisalId = req.getAppraisalId();
VUtils.isTrue(Objects.isNull(appraisalId)).throwMessage("未传入评价计划ID");
String projectName = req.getProjectName();
String buildOrgName = req.getBuildOrgName();
// 获取评价计划内的选择的项目信息
List<PerformanceAppraisalProject> appraisalProjectList = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class)
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId));
List<String> projectCodes = appraisalProjectList.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList());
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class)
.in(Project::getProjectCode, projectCodes)
.eq(Project::getNewest, Boolean.TRUE);

// 如果对项目名称进行模糊查询
if (StringUtils.isNotBlank(projectName) && StringUtils.isBlank(buildOrgName)){
wrapper.like(Project::getProjectName,projectName);
}
// 如果对申报单位进行模糊查询
else if (StringUtils.isNotBlank(buildOrgName) && StringUtils.isBlank(projectName)) {
wrapper.like(Project::getBuildOrgName,buildOrgName);
}
// 同时对项目名称和申报单位进行模糊查询
else if (StringUtils.isNotBlank(projectName) && StringUtils.isNotBlank(buildOrgName)) {
wrapper.like(Project::getProjectName, projectName)
.like(Project::getBuildOrgName, buildOrgName);
}
List<Project> projects = projectService.list(wrapper);
if (CollUtil.isEmpty(projects)){
return PageVo.empty();
}
List<PerformanceAppraisalProjectVO> voList = projects.stream().map(p -> {
PerformanceAppraisalProjectVO appraisalProjectVo = new PerformanceAppraisalProjectVO();
BeanUtil.copyProperties(p, appraisalProjectVo);
appraisalProjectVo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType()));
return appraisalProjectVo;
}).collect(Collectors.toList());
return PageVo.of(voList,voList.size());
}
}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AddAppraisalObjectDTO.java View File

@@ -0,0 +1,36 @@
package com.ningdatech.pmapi.performance.model.dto;

import java.io.Serializable;
import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Range;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* 评级计划-添加评价对象
* @return
* @author CMM
* @since 2023/08/02 11:41
*/
@Data
@ApiModel(value = "评级计划-添加评价对象", description = "评级计划-添加评价对象")
public class AddAppraisalObjectDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("评价计划ID")
private Long appraisalId;

@ApiModelProperty("评价项目 只有ID 和是否复评")
private List<Long> projectIds;

@ApiModelProperty("评价应用ids")
private List<Long> applicationIds;
}

+ 13
- 27
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java View File

@@ -6,9 +6,11 @@ import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
@@ -27,37 +29,21 @@ public class PerformanceAppraisalCreateDTO implements Serializable {

@ApiModelProperty("计划名称")
@NotBlank(message = "请输入计划名称")
@Size(max = 50)
private String name;

@ApiModelProperty("自评开始时间")
@NotNull(message = "自评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalStart;
@ApiModelProperty("终验后 xx 天开始自评")
@NotNull(message = "开始自评时间不能为空")
@Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100")
private Integer startSelfDays;

@ApiModelProperty("自评结束时间")
@NotNull(message = "自评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalEnd;
@ApiModelProperty("xx 天需完成自评")
@NotNull(message = "完成自评时间不能为空")
@Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100")
private Integer completeSelfDays;

@ApiModelProperty("复评开始时间")
@NotNull(message = "复评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalStart;

@ApiModelProperty("复评结束时间")
@NotNull(message = "复评时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalEnd;

@ApiModelProperty("核查开始时间")
@NotNull(message = "核查时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationStart;

@ApiModelProperty("核查结束时间")
@NotNull(message = "核查时间错误")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationEnd;
@ApiModelProperty("备注")
private String remark;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
@NotBlank(message = "评价目标不能为空")


+ 11
- 22
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@@ -28,32 +29,20 @@ public class PerformanceAppraisalEditDTO implements Serializable {
private Long id;

@ApiModelProperty("计划名称")
@JSONField(format = "yyyy-MM-dd")
private String name;

@ApiModelProperty("自评开始时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalStart;
@ApiModelProperty("终验后 xx 天开始自评")
@NotNull(message = "开始自评时间不能为空")
@Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100")
private Integer startSelfDays;

@ApiModelProperty("自评结束时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime selfAppraisalEnd;
@ApiModelProperty("xx 天需完成自评")
@NotNull(message = "完成自评时间不能为空")
@Range(min = 0, max = 100, message = "数值范围不正确,数值应为1~100")
private Integer completeSelfDays;

@ApiModelProperty("复评开始时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalStart;

@ApiModelProperty("复评结束时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime reAppraisalEnd;

@ApiModelProperty("核查开始时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationStart;

@ApiModelProperty("核查结束时间")
@JSONField(format = "yyyy-MM-dd")
private LocalDateTime verificationEnd;
@ApiModelProperty("备注")
private String remark;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
private String target;


+ 10
- 16
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java View File

@@ -35,24 +35,18 @@ public class PerformanceAppraisal implements Serializable {
@ApiModelProperty("计划名称")
private String name;

@ApiModelProperty("自评开始时间")
private LocalDateTime selfAppraisalStart;

@ApiModelProperty("自评结束时间")
private LocalDateTime selfAppraisalEnd;

@ApiModelProperty("复评开始时间")
private LocalDateTime reAppraisalStart;
@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
private String target;

@ApiModelProperty("复评结束时间")
private LocalDateTime reAppraisalEnd;
@ApiModelProperty("终验后 xx 天开始自评")
private Integer startSelfDays;

@ApiModelProperty("核查开始时间")
private LocalDateTime verificationStart;
@ApiModelProperty("xx 天需完成自评")
private Integer completeSelfDays;

@ApiModelProperty("核查结束时间")
private LocalDateTime verificationEnd;
@ApiModelProperty("区域编码")
private String regionCode;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
private String target;
@ApiModelProperty("备注")
private String remark;
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java View File

@@ -35,6 +35,6 @@ public class PerformanceAppraisalApplication implements Serializable {
@ApiModelProperty("计划id")
private Long appraisalId;

@ApiModelProperty("应用id")
@ApiModelProperty("应用ID")
private Long applicationId;
}

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java View File

@@ -43,4 +43,10 @@ public class PerformanceAppraisalProject implements Serializable {

@ApiModelProperty("是否核查")
private Boolean isReAppraisal;

@ApiModelProperty("自评开始时间")
private LocalDateTime selfAppraisalStart;

@ApiModelProperty("自评结束时间")
private LocalDateTime selfAppraisalEnd;
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java View File

@@ -38,8 +38,8 @@ public class PerformanceAppraisalProjectGroup implements Serializable {
@ApiModelProperty("计划id")
private Long appraisalId;

@ApiModelProperty("分组内的所有项目id")
private String projectIds;
@ApiModelProperty("分组内的所有项目code")
private String projectCodes;

@ApiModelProperty("复评人员")
private String reAppraisalUsers;


+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java View File

@@ -53,4 +53,10 @@ public class PerformanceIndicatorProjectTemplate implements Serializable {

@ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上")
private Integer amountRange;

@ApiModelProperty("项目标签ID")
private Long projectTagId;

@ApiModelProperty("项目标签名称")
private String projectTagName;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java View File

@@ -39,4 +39,13 @@ public class PerformanceAppraisalListReq extends PagePo {

@ApiModelProperty("指标级别 1一级指标 2二级指标 3三级指标")
private Integer indexLevel;

@ApiModelProperty("应用名称")
private String applicationName;

@ApiModelProperty("申报单位")
private String buildOrgName;

@ApiModelProperty("评价计划ID")
private Long appraisalId;
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java View File

@@ -18,8 +18,8 @@ public class PerformanceAppraisalApplicationVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目ID")
private Long id;
@ApiModelProperty("应用ID")
private Long appId;

@ApiModelProperty("应用名称")
private String applicationName;


+ 16
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.performance.model.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -51,4 +52,19 @@ public class PerformanceAppraisalProjectVO implements Serializable {

@ApiModelProperty("是否可自评")
private Boolean canSelfAppraisal = Boolean.FALSE;

@ApiModelProperty("自评开始时间")
private LocalDateTime selfAppraisalStart;

@ApiModelProperty("自评结束时间")
private LocalDateTime selfAppraisalEnd;

@ApiModelProperty("自评总分")
private BigDecimal selfAppraisalScore;

@ApiModelProperty("打分时间")
@JSONField(format = "yyyy-MM-dd HH:mm")
private LocalDateTime scoreTime;


}

+ 12
- 18
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java View File

@@ -31,24 +31,6 @@ public class PerformanceAppraisalVO implements Serializable {
@ApiModelProperty("计划名称")
private String name;

@ApiModelProperty("自评开始时间")
private LocalDateTime selfAppraisalStart;

@ApiModelProperty("自评结束时间")
private LocalDateTime selfAppraisalEnd;

@ApiModelProperty("复评开始时间")
private LocalDateTime reAppraisalStart;

@ApiModelProperty("复评结束时间")
private LocalDateTime reAppraisalEnd;

@ApiModelProperty("核查开始时间")
private LocalDateTime verificationStart;

@ApiModelProperty("核查结束时间")
private LocalDateTime verificationEnd;

@ApiModelProperty("评价目标 1项目 2应用 可多选 1,2")
private String target;

@@ -57,4 +39,16 @@ public class PerformanceAppraisalVO implements Serializable {

@ApiModelProperty("评价应用列表")
private List<PerformanceAppraisalApplicationVO> applications;

@ApiModelProperty("项目分组信息")
private List<PerformanceAppraisalProjectGroupVO> groups;

@ApiModelProperty("终验后 xx 天开始自评")
private Integer startSelfDays;

@ApiModelProperty("xx 天需完成自评")
private Integer completeSelfDays;

@ApiModelProperty("备注")
private String remark;
}

+ 6
- 0
pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java View File

@@ -55,4 +55,10 @@ public class ProjectIndexTemplateVO implements Serializable {

@ApiModelProperty("附加绩效指标详情")
private List<ProjectTemplateDetailVO> additionalIndexDetails;

@ApiModelProperty("项目标签ID")
private Long projectTagId;

@ApiModelProperty("项目标签名称")
private String projectTagName;
}

+ 64
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java View File

@@ -0,0 +1,64 @@
package com.ningdatech.pmapi.portrait.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.portrait.manage.TagManage;
import com.ningdatech.pmapi.portrait.model.dto.TagDTO;
import com.ningdatech.pmapi.portrait.model.dto.TagToProjectDTO;
import com.ningdatech.pmapi.portrait.model.req.TagPageReq;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* @Classname TagController
* @Description
* @Date 2023/8/2 14:11
* @Author PoffyZhang
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "项目画像-标签")
@RequestMapping("/api/v1/portrait/tag")
public class TagController {
private final TagManage tagManage;

@GetMapping("/list/{areaCode}")
@ApiOperation("按区域查询标签列表")
public PageVo<TagVO> list(@PathVariable String areaCode, TagPageReq req) {
return tagManage.list(areaCode,req);
}

@PostMapping("/save")
@ApiOperation("保存标签")
@WebLog("保存标签")
public String save(@Valid @RequestBody TagDTO dto) {
return tagManage.save(dto);
}

@PostMapping("/delete/{id}")
@ApiOperation("删除标签")
@WebLog("删除标签")
public String save(@PathVariable Long id) {
return tagManage.delete(id);
}

@PostMapping("/save-to-project")
@ApiOperation("设置标签到项目")
@WebLog("设置标签到项目")
public String saveToProject(@Valid @RequestBody List<TagToProjectDTO> dtos) {
return tagManage.saveToProject(dtos);
}

@PostMapping("/remove-tag-to-project")
@ApiOperation("项目删除标签")
@WebLog("项目删除标签")
public String removeTagToProject(@Valid @RequestBody TagToProjectDTO dto) {
return tagManage.removeTagToProject(dto);
}
}

+ 199
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java View File

@@ -0,0 +1,199 @@
package com.ningdatech.pmapi.portrait.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.portrait.model.dto.TagDTO;
import com.ningdatech.pmapi.portrait.model.dto.TagToProjectDTO;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;
import com.ningdatech.pmapi.portrait.model.entity.Tag;
import com.ningdatech.pmapi.portrait.model.req.TagPageReq;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import com.ningdatech.pmapi.portrait.service.IProjectTagService;
import com.ningdatech.pmapi.portrait.service.ITagService;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname TagManage
* @Description
* @Date 2023/8/2 14:10
* @Author PoffyZhang
*/
@Component
@Slf4j
@AllArgsConstructor
public class TagManage {

private final ITagService tagService;

private final IProjectService projectService;

private final IProjectTagService projectTagService;

/**
* 标签分页
* @param areaCode
* @param req
* @return
*/
public PageVo<TagVO> list(String areaCode, TagPageReq req) {
LambdaQueryWrapper<Tag> query = Wrappers.lambdaQuery(Tag.class)
.eq(Tag::getAreaCode, areaCode)
.like(StringUtils.isNotBlank(req.getName()),Tag::getName,req.getName())
.orderByDesc(Tag::getUpdateOn);
checkAuth(query,LoginUserUtil.loginUserDetail());
Page<Tag> page = tagService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
return PageVo.empty();
}
List<TagVO> records = CollUtils.convert(page.getRecords(),
t -> BeanUtil.copyProperties(t,TagVO.class));
return PageVo.of(records, total);
}

/**
* 权限控制
* @param query
* @param user
*/
private void checkAuth(LambdaQueryWrapper<Tag> query, UserInfoDetails user) {
//如果是超管
if(user.getSuperAdmin()){
log.info(user.getUsername() + " 是超管,可以看所有标签");
}else if(user.getRegionAdmin()){
//如果是区域管理员
log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "标签");
query.eq(Tag::getAreaCode,user.getRegionCode());
}else{
//其它角色全都看不见
query.eq(Tag::getId,0L);
}
}

/**
* 保存标签
* @param dto
* @return
*/
public String save(TagDTO dto) {
deduplicationName(dto);
UserInfoDetails user = LoginUserUtil.loginUserDetail();
Tag entity = BeanUtil.copyProperties(dto,Tag.class);
if(Objects.nonNull(dto.getId())){
Tag old = tagService.getById(dto.getId());
VUtils.isTrue(Objects.isNull(old)).throwMessage("此id标签不存在!");
entity.setId(old.getId());
}else{
entity.setId(null);
entity.setCreateOn(LocalDateTime.now());
entity.setCreateBy(user.getUsername());
}
entity.setUpdateOn(LocalDateTime.now());
entity.setUpdateBy(user.getUsername());
tagService.saveOrUpdate(entity);

return "保存成功";
}

/**
* 标签名 去重
* @param dto
*/
private void deduplicationName(TagDTO dto) {
if(StringUtils.isNotBlank(dto.getName())){
long count = tagService.count(Wrappers.lambdaQuery(Tag.class)
.eq(Tag::getAreaCode, dto.getAreaCode())
.eq(Tag::getName, dto.getName())
.ne(Objects.nonNull(dto.getId()), Tag::getId, dto.getId()));
VUtils.isTrue(count > 0).throwMessage("保存失败!此区域标签名重复!");
}
}

public String saveToProject(List<TagToProjectDTO> dtos) {
if(CollUtil.isEmpty(dtos)){
return "参入的标签为空";
}
UserInfoDetails user = LoginUserUtil.loginUserDetail();
String projectCode = dtos.get(0).getProjectCode();
Project project = projectService.getProjectByCode(projectCode);
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!");
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class)
.eq(ProjectTag::getProjectCode,projectCode));
//去重
dtos = dtos.stream().distinct().collect(Collectors.toList());
for(TagToProjectDTO dto : dtos){
Long tagId = dto.getTagId();
Tag tag = tagService.getById(tagId);
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!");
VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode()))
.throwMessage("项目和标签不是一个区域的!");
ProjectTag projectTag = new ProjectTag();
projectTag.setProjectCode(projectCode);
projectTag.setTagId(tagId);
projectTag.setCreateOn(LocalDateTime.now());
projectTag.setCreateBy(user.getUsername());
projectTagService.save(projectTag);
}

return "保存成功";
}

public String removeTagToProject(TagToProjectDTO dto) {
String projectCode = dto.getProjectCode();
Project project = projectService.getProjectByCode(projectCode);
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!");
Long tagId = dto.getTagId();
Tag tag = tagService.getById(tagId);
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!");

VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode()))
.throwMessage("项目和标签不是一个区域的!");

ProjectTag pt = projectTagService.getOne(Wrappers.lambdaQuery(ProjectTag.class)
.eq(ProjectTag::getProjectCode, projectCode)
.eq(ProjectTag::getTagId, tagId));

VUtils.isTrue(Objects.isNull(pt))
.throwMessage("该项目没有绑定此标签!");
projectTagService.removeById(pt.getId());

return "删除成功";
}

/**
* 删除标签
* @param id
* @return
*/
public String delete(Long id) {
Tag tag = tagService.getById(id);
VUtils.isTrue(Objects.isNull(tag))
.throwMessage("删除失败 此标签ID不存在!");

if(tagService.removeById(id)){
//关联关系 也要删
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class)
.eq(ProjectTag::getTagId,id));
return "删除成功";
}
return "删除失败";
}
}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java View File

@@ -0,0 +1,15 @@
package com.ningdatech.pmapi.portrait.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
public interface ProjectTagMapper extends BaseMapper<ProjectTag> {

}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java View File

@@ -0,0 +1,15 @@
package com.ningdatech.pmapi.portrait.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.portrait.model.entity.Tag;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
public interface TagMapper extends BaseMapper<Tag> {

}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java View File

@@ -0,0 +1,36 @@
package com.ningdatech.pmapi.portrait.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
* <p>
* 标签
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "Tag对象", description = "标签")
public class TagDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("标签名")
private String name;

@ApiModelProperty("备注")
private String remark;

@ApiModelProperty("区域CODE")
@NotNull(message = "区域CODE必填")
private String areaCode;
}

+ 31
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java View File

@@ -0,0 +1,31 @@
package com.ningdatech.pmapi.portrait.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
* <p>
* 标签
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "Tag对象", description = "标签")
public class TagToProjectDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@NotNull(message = "标签ID必填")
private Long tagId;

@ApiModelProperty("当前项目编号")
@NotNull(message = "项目编号必填")
private String projectCode;
}

+ 40
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java View File

@@ -0,0 +1,40 @@
package com.ningdatech.pmapi.portrait.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 标签项目关联
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@TableName("nd_project_tag")
@ApiModel(value = "ProjectTag对象", description = "标签项目关联")
public class ProjectTag implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("项目编号")
private String projectCode;

@ApiModelProperty("标签ID")
private Long tagId;

private LocalDateTime createOn;
private String createBy;
}

+ 45
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java View File

@@ -0,0 +1,45 @@
package com.ningdatech.pmapi.portrait.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 标签
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@TableName("nd_tag")
@ApiModel(value = "Tag对象", description = "标签")
public class Tag implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("标签名")
private String name;

@ApiModelProperty("备注")
private String remark;

@ApiModelProperty("区域CODE")
private String areaCode;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;
}

+ 25
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java View File

@@ -0,0 +1,25 @@
package com.ningdatech.pmapi.portrait.model.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

/**
* @Classname TagPageReq
* @Description
* @Date 2023/8/2 14:16
* @Author PoffyZhang
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("标签列表查询")
@EqualsAndHashCode(callSuper = true)
public class TagPageReq extends PagePo {

@ApiModelProperty("标签名")
private String name;

}

+ 40
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java View File

@@ -0,0 +1,40 @@
package com.ningdatech.pmapi.portrait.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 标签
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "Tag对象", description = "标签")
public class TagVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("标签名")
private String name;

@ApiModelProperty("备注")
private String remark;

@ApiModelProperty("区域CODE")
private String areaCode;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;
}

+ 14
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java View File

@@ -0,0 +1,14 @@
package com.ningdatech.pmapi.portrait.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;

/**
* @Classname ITagService
* @Description
* @Date 2023/8/2 10:47
* @Author PoffyZhang
*/
public interface IProjectTagService extends IService<ProjectTag> {

}

+ 14
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java View File

@@ -0,0 +1,14 @@
package com.ningdatech.pmapi.portrait.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.portrait.model.entity.Tag;

/**
* @Classname ITagService
* @Description
* @Date 2023/8/2 10:47
* @Author PoffyZhang
*/
public interface ITagService extends IService<Tag> {

}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.portrait.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.portrait.mapper.ProjectTagMapper;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;
import com.ningdatech.pmapi.portrait.service.IProjectTagService;
import org.springframework.stereotype.Service;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
@Service
public class ProjectTagServiceImpl extends ServiceImpl<ProjectTagMapper,
ProjectTag> implements IProjectTagService {


}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java View File

@@ -0,0 +1,21 @@
package com.ningdatech.pmapi.portrait.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.portrait.mapper.TagMapper;
import com.ningdatech.pmapi.portrait.model.entity.Tag;
import com.ningdatech.pmapi.portrait.service.ITagService;
import org.springframework.stereotype.Service;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
@Service
public class TagServiceImpl extends ServiceImpl<TagMapper,
Tag> implements ITagService {


}

+ 0
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java View File

@@ -46,8 +46,6 @@ public class ConstructionPlanController {
return "建设方案申报 【" + instanceId + "】 成功";
}



@GetMapping("/export")
@ApiOperation("可申报建设方案项目列表导出")
@WebLog("可申报建设方案项目列表导出")


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -154,7 +154,7 @@ public class DeclaredProjectManage {
Project project = new Project();
BeanUtils.copyProperties(projectInfo,project);
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project);
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap);
String instanceId = processService.startProcessLs(model, params,orgModelMap);
log.info("申报项目成功 【{}】", instanceId);

//如果是重新提交的话 判断下 项目是否存在


+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java View File

@@ -37,7 +37,6 @@ public class AnnualPlanController {

@GetMapping("/list")
@ApiOperation("年度计划库列表")
@WebLog("年度计划库列表")
public PageVo<AnnualPlanListItemVO> annualPlanLibList(ProjectListReq req) {
return annualPlanLibManage.annulPlanLibList(req);
}


+ 0
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java View File

@@ -6,14 +6,10 @@ import com.ningdatech.pmapi.projectlib.manage.ApplicationManage;
import com.ningdatech.pmapi.projectlib.model.dto.ApplicationAppCodeSaveDTO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**


+ 86
- 14
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
@@ -34,26 +35,21 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.performance.model.dto.ProjectCoreBusinessDTO;
import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators;
import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService;
import com.ningdatech.pmapi.portrait.model.entity.ProjectTag;
import com.ningdatech.pmapi.portrait.model.entity.Tag;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import com.ningdatech.pmapi.portrait.service.IProjectTagService;
import com.ningdatech.pmapi.portrait.service.ITagService;
import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.model.entity.PaymentPlan;
import com.ningdatech.pmapi.projectdeclared.model.entity.PreInsAcceptancePerson;
import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PaymentPlanVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectdeclared.service.IContractService;
import com.ningdatech.pmapi.projectdeclared.service.IPaymentPlanService;
import com.ningdatech.pmapi.projectdeclared.service.IPreInsAcceptancePersonService;
import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService;
import com.ningdatech.pmapi.projectdeclared.model.entity.*;
import com.ningdatech.pmapi.projectdeclared.model.vo.*;
import com.ningdatech.pmapi.projectdeclared.service.*;
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil;
import com.ningdatech.pmapi.projectlib.constant.ProjectConstant;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle;
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectApplicationDTO;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.*;
import com.ningdatech.pmapi.projectlib.model.req.ProjectApplicationListReq;
@@ -63,6 +59,13 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.*;
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo;
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification;
import com.ningdatech.pmapi.safety.model.vo.PersonSafetyInfoVO;
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO;
import com.ningdatech.pmapi.safety.model.vo.SupplierSafetyQualificationVO;
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService;
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService;
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq;
import com.ningdatech.pmapi.todocenter.service.ITodoService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
@@ -114,6 +117,15 @@ public class ProjectLibManage {
private final ITodoService todoService;
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService;

private final IOperationService operationService;

private final IProjectTagService projectTagService;
private final ITagService tagService;

private final ISupplierSafetyQualificationService supplierSafetyQualificationService;

private final IPersonSafetyInfoService personSafetyInfoService;

public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
query.eq(Project::getNewest, Boolean.TRUE);
@@ -156,6 +168,25 @@ public class ProjectLibManage {
return PageVo.empty();
}
UserFullInfoDTO finalUser = user;

Set<String> projectCodes = page.getRecords().stream()
.map(Project::getProjectCode).collect(Collectors.toSet());
List<ProjectTag> pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class)
.in(ProjectTag::getProjectCode, projectCodes));
Map<String,List<ProjectTag>> tagMap = Maps.newHashMap();
Map<Long,String> tagNameMap = Maps.newHashMap();
if(CollUtil.isNotEmpty(pts)){
tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode));
Set<Long> tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet());
List<Tag> tags = tagService.list(Wrappers.lambdaQuery(Tag.class)
.in(Tag::getId, tagIds));
if(CollUtil.isNotEmpty(tags)){
tagNameMap = tags.stream().collect(Collectors.toMap(Tag::getId,Tag::getName));
}
}
Map<String, List<ProjectTag>> finalTagMap = tagMap;
Map<Long,String> finalTagNameMap = tagNameMap;

List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
@@ -181,11 +212,28 @@ public class ProjectLibManage {
item.setCanPreDeclared(Boolean.TRUE);
}
item.setPrePlanProjectId(w.getPrePlanProjectId());
setTag(item,finalTagMap,finalTagNameMap);
return item;
});
return PageVo.of(records, total);
}

private void setTag(ProjectLibListItemVO item, Map<String, List<ProjectTag>> finalTagMap, Map<Long, String> finalTagNameMap) {
if(finalTagMap.containsKey(item.getProjectCode())){
List<TagVO> tags = Lists.newArrayList();
List<ProjectTag> projectTags = finalTagMap.get(item.getProjectCode());
for(ProjectTag pt :projectTags){
if(finalTagNameMap.containsKey(pt.getTagId())){
TagVO vo = new TagVO();
vo.setId(pt.getTagId());
vo.setName(finalTagNameMap.get(pt.getTagId()));
tags.add(vo);
}
}
item.setTags(tags);
}
}

public List<Project> projectList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
return projectService.list(query);
@@ -635,6 +683,31 @@ public class ProjectLibManage {
contractVO.getTotalAmount()));
}

//查询实施信息
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class)
.in(Operation::getProjectId, allVersionProjectId)
.orderByAsc(Operation::getCreateOn)
.last(BizConst.LIMIT_1));
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class));

SafetyMonitorVO safetyVo = new SafetyMonitorVO();
//查询风险监测
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(ssq)){
safetyVo.setSupplierSafetyQualification(ssq.stream()
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class))
.collect(Collectors.toList()));
}
vo.setSafetyInfo(safetyVo);

List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode()));
if(CollUtil.isNotEmpty(psi)){
safetyVo.setPersonSafetyInfo(psi.stream()
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class))
.collect(Collectors.toList()));
}

//查询初验信息
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class)
@@ -1150,7 +1223,6 @@ public class ProjectLibManage {
projectApplication.setBuildOrgName(finalProject.getBuildOrgName());
projectApplication.setProjectVersion(version);
projectApplication.setIsConstruct(isConstruct);

if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){
projectApplication.setApplicationName(null);
}


+ 31
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java View File

@@ -5,11 +5,15 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import com.ningdatech.pmapi.projectdeclared.model.entity.Contract;
import com.ningdatech.pmapi.projectdeclared.model.vo.ContractVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.OperationVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO;
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO;
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -374,6 +378,9 @@ public class ProjectDetailVO {
@ApiModelProperty("初审人员")
private List<PreInsAcceptancePersonVO> acceptancePersons;

@ApiModelProperty("实施信息")
private OperationVO operation;

@ApiModelProperty("版本号str")
private String versionStr;

@@ -395,6 +402,9 @@ public class ProjectDetailVO {
@ApiModelProperty("审批详情")
private ProcessProgressDetailVo process;

@ApiModelProperty("标签")
private List<TagVO> tags;

@ApiModelProperty("是否退回|驳回的项目版本")
private Boolean isBackReject;

@@ -421,4 +431,25 @@ public class ProjectDetailVO {
this.dynamicForm = JSON.parseObject(dynamicFormStr, Map.class);
}
}

@ApiModelProperty("项目阶段中文")
private String stageName;
public String getStageName(){
if(Objects.nonNull(this.stage)){
return ProjectStatusEnum.getDesc(this.stage);
}
return StringUtils.EMPTY;
}

@ApiModelProperty("项目状态中文")
private String statusName;
public String getStatusName(){
if(Objects.nonNull(this.status)){
return ProjectStatusEnum.getDesc(this.status);
}
return StringUtils.EMPTY;
}

@ApiModelProperty("安全风险监测信息")
private SafetyMonitorVO safetyInfo;
}

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java View File

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.projectlib.model.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.pmapi.common.enumeration.CommonEnum;
import com.ningdatech.pmapi.portrait.model.vo.TagVO;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
@@ -16,6 +17,7 @@ import lombok.experimental.Tolerate;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

@@ -148,6 +150,9 @@ public class ProjectLibListItemVO {
@ApiModelProperty("初步方案项目ID")
private Long prePlanProjectId;

@ApiModelProperty("标签")
private List<TagVO> tags;

//预审申报时候 需不需要上传上级条线意见文件
private Boolean needUploadSuperLineFile;
public Boolean getNeedUploadSuperLineFile() {


+ 65
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/controller/SafetyRiskController.java View File

@@ -0,0 +1,65 @@
package com.ningdatech.pmapi.safety.controller;

import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.safety.manage.SafetyRiskManage;
import com.ningdatech.pmapi.safety.model.dto.PersonSafetyInfoDTO;
import com.ningdatech.pmapi.safety.model.dto.SupplierSafetyQualificationDTO;
import com.ningdatech.pmapi.safety.model.vo.ProjectMonitorVO;
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* @Classname SafetyRiskController
* @Description
* @Date 2023/8/2 9:15
* @Author PoffyZhang
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "安全风险监测")
@RequestMapping("/api/v1/safety-risk")
public class SafetyRiskController {

private final SafetyRiskManage safetyRiskManage;

@GetMapping("/person-monitor/list")
@ApiOperation("安全人员监控列表")
public PageVo<ProjectMonitorVO> personMonitorList(ProjectListReq req) {
return safetyRiskManage.personMonitorList(req);
}

@PostMapping("/person-monitor/save")
@ApiOperation("安全人员监控信息保存")
@WebLog("安全人员监控信息保存")
public String personMonitorSave(@Valid @RequestBody List<PersonSafetyInfoDTO> dtos) {
return safetyRiskManage.personMonitorSave(dtos);
}

@PostMapping("/supplier-safety-qualification/save")
@ApiOperation("供应商安全资质保存")
@WebLog("供应商安全资质保存")
public String supplierSafetyQualificationSave(@Valid @RequestBody List<SupplierSafetyQualificationDTO> dtos) {
return safetyRiskManage.supplierSafetyQualificationSave(dtos);
}

@GetMapping("/detail/{projectCode}")
@ApiOperation("安全人员管控详情")
public SafetyMonitorVO personMonitorDetail(@PathVariable String projectCode) {
return safetyRiskManage.personMonitorDetail(projectCode);
}

@GetMapping("/operation-monitor/search/{projectCode}")
@ApiOperation("安全运行监控-查询监测(对接外部平台)")
public JSONObject operationnMonitorList(@PathVariable String projectCode) {
return safetyRiskManage.operationnMonitorSearch(projectCode);
}
}

+ 218
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java View File

@@ -0,0 +1,218 @@
package com.ningdatech.pmapi.safety.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.safety.model.dto.PersonSafetyInfoDTO;
import com.ningdatech.pmapi.safety.model.dto.SupplierSafetyQualificationDTO;
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo;
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification;
import com.ningdatech.pmapi.safety.model.vo.PersonSafetyInfoVO;
import com.ningdatech.pmapi.safety.model.vo.ProjectMonitorVO;
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO;
import com.ningdatech.pmapi.safety.model.vo.SupplierSafetyQualificationVO;
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService;
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* @Classname SafetyRiskManage
* @Description
* @Date 2023/8/2 9:17
* @Author PoffyZhang
*/
@Component
@Slf4j
@AllArgsConstructor
public class SafetyRiskManage {

private final IProjectService projectService;

private final ISupplierSafetyQualificationService supplierSafetyQualificationService;

private final IPersonSafetyInfoService personSafetyInfoService;

/**
* 列表
* @param req
* @return
*/
public PageVo<ProjectMonitorVO> personMonitorList(ProjectListReq req) {
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.ge(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode())
.ne(Project::getStatus, ProjectStatusEnum.OPERATION.getCode())
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName())
.like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName())
.orderByDesc(Project::getUpdateOn);
checkAuth(query,LoginUserUtil.loginUserDetail());
Page<Project> page = projectService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
return PageVo.empty();
}
List<ProjectMonitorVO> records = CollUtils.convert(page.getRecords(),
p -> BeanUtil.copyProperties(p,ProjectMonitorVO.class));
return PageVo.of(records, total);
}

/**
* 权限控制
* @param query
* @param user
*/
private void checkAuth(LambdaQueryWrapper<Project> query, UserInfoDetails user) {
//如果是超管
if(user.getSuperAdmin()){
log.info(user.getUsername() + " 是超管,可以看所有项目");
}else if(user.getRegionAdmin()){
//如果是区域管理员
log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "项目");
query.eq(Project::getAreaCode,user.getRegionCode());
}else if(user.getIsOrgAdmin()){
//单位管理员
log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getEmpPosUnitName() + " 项目");
query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode());
}else{
//其它角色全都看不见
query.eq(Project::getId,0L);
}
}

public SafetyMonitorVO personMonitorDetail(String projectCode) {
SafetyMonitorVO vo = new SafetyMonitorVO();
Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getProjectCode, projectCode)
.last(BizConst.LIMIT_1));

if(Objects.isNull(project)){
return null;
}

List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectCode));
if(CollUtil.isNotEmpty(ssq)){
vo.setSupplierSafetyQualification(ssq.stream()
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class))
.collect(Collectors.toList()));
}

List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectCode));
if(CollUtil.isNotEmpty(psi)){
vo.setPersonSafetyInfo(psi.stream()
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class))
.collect(Collectors.toList()));
}

return vo;
}

public JSONObject operationnMonitorSearch(String projectCode) {
return null;
}

/**
* 保存 供应商安全资质
* @param dtos
* @return
*/
public String supplierSafetyQualificationSave(List<SupplierSafetyQualificationDTO> dtos) {
if(CollUtil.isEmpty(dtos)){
return "数据为空";
}

UserInfoDetails user = LoginUserUtil.loginUserDetail();

String projectCode = dtos.get(0).getProjectCode();
if(StringUtils.isBlank(projectCode)){
throw new BizException("参数有误!");
}
supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class)
.eq(SupplierSafetyQualification::getProjectCode, projectCode));

Integer sucessNum = 0;
for(SupplierSafetyQualificationDTO dto : dtos){
projectCode = dto.getProjectCode();
Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getProjectCode, projectCode)
.last(BizConst.LIMIT_1));

VUtils.isTrue(Objects.isNull(project)).throwMessage("此项目并不存在!");

SupplierSafetyQualification entity = BeanUtil.copyProperties(dto, SupplierSafetyQualification.class);
entity.setCreateBy(user.getUsername());
entity.setCreateOn(LocalDateTime.now());
entity.setProjectId(project.getId());
entity.setUpdateBy(user.getUsername());
entity.setUpdateOn(LocalDateTime.now());
if(supplierSafetyQualificationService.save(entity)){
sucessNum ++;
}
}

return "保存成功" + sucessNum + "条";
}

public String personMonitorSave(List<PersonSafetyInfoDTO> dtos) {
if(CollUtil.isEmpty(dtos)){
return "数据为空";
}

UserInfoDetails user = LoginUserUtil.loginUserDetail();

String projectCode = dtos.get(0).getProjectCode();
if(StringUtils.isBlank(projectCode)){
throw new BizException("参数有误!");
}
personSafetyInfoService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class)
.eq(PersonSafetyInfo::getProjectCode, projectCode));

Integer sucessNum = 0;
for(PersonSafetyInfoDTO dto : dtos){
projectCode = dto.getProjectCode();
Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getNewest, Boolean.TRUE)
.eq(Project::getProjectCode, projectCode)
.last(BizConst.LIMIT_1));

VUtils.isTrue(Objects.isNull(project)).throwMessage("此项目并不存在!");

PersonSafetyInfo entity = BeanUtil.copyProperties(dto, PersonSafetyInfo.class);
entity.setCreateBy(user.getUsername());
entity.setCreateOn(LocalDateTime.now());
entity.setProjectId(project.getId());
entity.setUpdateBy(user.getUsername());
entity.setUpdateOn(LocalDateTime.now());
if(personSafetyInfoService.save(entity)){
sucessNum ++;
}
}

return "保存成功" + sucessNum + "条";
}
}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/PersonSafetyInfoMapper.java View File

@@ -0,0 +1,15 @@
package com.ningdatech.pmapi.safety.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
public interface PersonSafetyInfoMapper extends BaseMapper<PersonSafetyInfo> {

}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/SupplierSafetyQualificationMapper.java View File

@@ -0,0 +1,15 @@
package com.ningdatech.pmapi.safety.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
public interface SupplierSafetyQualificationMapper extends BaseMapper<SupplierSafetyQualification> {

}

+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/PersonSafetyInfoDTO.java View File

@@ -0,0 +1,42 @@
package com.ningdatech.pmapi.safety.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 安全人员信息
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "PersonSafetyInfo对象", description = "安全人员信息")
public class PersonSafetyInfoDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目编号")
@NotBlank(message = "项目编号不能为空")
private String projectCode;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("人员姓名")
private String username;

@ApiModelProperty("调查报告")
private String investigationReport;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;
}

+ 36
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/SupplierSafetyQualificationDTO.java View File

@@ -0,0 +1,36 @@
package com.ningdatech.pmapi.safety.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
* <p>
* 供应商安全资质
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "SupplierSafetyQualification对象", description = "供应商安全资质")
public class SupplierSafetyQualificationDTO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("项目编号")
@NotBlank(message = "项目编号不能为空")
private String projectCode;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("安全资质")
private String safetyQualification;

@ApiModelProperty("安全协议")
private String safetyProtocol;
}

+ 48
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/PersonSafetyInfo.java View File

@@ -0,0 +1,48 @@
package com.ningdatech.pmapi.safety.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 安全人员信息
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@TableName("nd_person_safety_info")
@ApiModel(value = "PersonSafetyInfo对象", description = "安全人员信息")
public class PersonSafetyInfo implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("项目编号")
private String projectCode;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("人员姓名")
private String username;

@ApiModelProperty("调查报告")
private String investigationReport;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;
}

+ 45
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/SupplierSafetyQualification.java View File

@@ -0,0 +1,45 @@
package com.ningdatech.pmapi.safety.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 供应商安全资质
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@TableName("nd_supplier_safety_qualification")
@ApiModel(value = "SupplierSafetyQualification对象", description = "供应商安全资质")
public class SupplierSafetyQualification implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
@TableId(type = IdType.AUTO)
private Long id;

@ApiModelProperty("项目编号")
private String projectCode;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("安全资质")
private String safetyQualification;

@ApiModelProperty("安全协议")
private String safetyProtocol;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;
}

+ 43
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/PersonSafetyInfoVO.java View File

@@ -0,0 +1,43 @@
package com.ningdatech.pmapi.safety.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 安全人员信息
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "PersonSafetyInfo对象", description = "安全人员信息")
public class PersonSafetyInfoVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("项目编号")
private String projectCode;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("人员姓名")
private String username;

@ApiModelProperty("调查报告")
private String investigationReport;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;
}

+ 78
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/ProjectMonitorVO.java View File

@@ -0,0 +1,78 @@
package com.ningdatech.pmapi.safety.model.vo;

import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;
import java.util.Optional;

/**
* @Classname ProjectMonitorVO
* @Description
* @Date 2023/8/2 9:19
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "ProjectMonitorVO", description = "项目监控VO")
public class ProjectMonitorVO {

@ApiModelProperty("项目ID")
private Long id;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("项目编号")
private String projectCode;

@ApiModelProperty("申报单位code")
private String buildOrgCode;

@ApiModelProperty("申报单位名")
private String buildOrgName;

@ApiModelProperty("项目年度")
private Integer projectYear;

@ApiModelProperty("项目类型")
private Integer projectType;

@ApiModelProperty("项目类型名")
private String projectTypeName;

public String getProjectTypeName() {
if (Objects.nonNull(this.projectType)) {
Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType))
.ifPresent(desc -> this.projectTypeName = desc);
}
return this.projectTypeName;
}

@ApiModelProperty("项目阶段")
private Integer stage;

@ApiModelProperty("项目状态")
private Integer status;

@ApiModelProperty("项目阶段中文")
private String stageName;
public String getStageName(){
if(Objects.nonNull(this.stage)){
return ProjectStatusEnum.getDesc(this.stage);
}
return StringUtils.EMPTY;
}

@ApiModelProperty("项目状态中文")
private String statusName;
public String getStatusName(){
if(Objects.nonNull(this.status)){
return ProjectStatusEnum.getDesc(this.status);
}
return StringUtils.EMPTY;
}
}

+ 23
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SafetyMonitorVO.java View File

@@ -0,0 +1,23 @@
package com.ningdatech.pmapi.safety.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;

/**
* @Classname SafetyMonitorVO
* @Description
* @Date 2023/8/2 9:19
* @Author PoffyZhang
*/
@Data
@ApiModel(value = "SafetyMonitorVO", description = "监控VO")
public class SafetyMonitorVO {

@ApiModelProperty("人员安全信息")
private List<PersonSafetyInfoVO> personSafetyInfo;

@ApiModelProperty("供应商安全资质")
private List<SupplierSafetyQualificationVO> supplierSafetyQualification;
}

+ 43
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SupplierSafetyQualificationVO.java View File

@@ -0,0 +1,43 @@
package com.ningdatech.pmapi.safety.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* <p>
* 供应商安全资质
* </p>
*
* @author ZPF
* @since 2023-08-02
*/
@Data
@ApiModel(value = "SupplierSafetyQualification对象", description = "供应商安全资质")
public class SupplierSafetyQualificationVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("主键")
private Long id;

@ApiModelProperty("项目编号")
private String projectCode;

@ApiModelProperty("项目ID")
private Long projectId;

@ApiModelProperty("安全资质")
private String safetyQualification;

@ApiModelProperty("安全协议")
private String safetyProtocol;

private LocalDateTime createOn;
private LocalDateTime updateOn;
private String createBy;
private String updateBy;
}

+ 14
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/service/IPersonSafetyInfoService.java View File

@@ -0,0 +1,14 @@
package com.ningdatech.pmapi.safety.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo;

/**
* @Classname IPersonSafetyInfoService
* @Description
* @Date 2023/8/2 10:47
* @Author PoffyZhang
*/
public interface IPersonSafetyInfoService extends IService<PersonSafetyInfo> {

}

+ 14
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/service/ISupplierSafetyQualificationService.java View File

@@ -0,0 +1,14 @@
package com.ningdatech.pmapi.safety.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification;

/**
* @Classname ISupplierSafetyQulificationService
* @Description
* @Date 2023/8/2 10:47
* @Author PoffyZhang
*/
public interface ISupplierSafetyQualificationService extends IService<SupplierSafetyQualification> {

}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/PersonSafetyInfoServiceImpl.java View File

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.safety.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.safety.mapper.PersonSafetyInfoMapper;
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo;
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService;
import org.springframework.stereotype.Service;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
@Service
public class PersonSafetyInfoServiceImpl extends ServiceImpl<PersonSafetyInfoMapper,
PersonSafetyInfo> implements IPersonSafetyInfoService {

}

+ 20
- 0
pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/SupplierSafetyQualificationServiceImpl.java View File

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.safety.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.safety.mapper.SupplierSafetyQualificationMapper;
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification;
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService;
import org.springframework.stereotype.Service;

/**
* <p>
* </p>
*
* @author ZPF
* @since 2023-08-2
*/
@Service
public class SupplierSafetyQualificationServiceImpl extends ServiceImpl<SupplierSafetyQualificationMapper,
SupplierSafetyQualification> implements ISupplierSafetyQualificationService {

}

+ 142
- 0
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java View File

@@ -0,0 +1,142 @@
package com.ningdatech.pmapi.scheduler.listener;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords;
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.wflow.enums.WarningRuleTypeEnum;
import com.wflow.workflow.notify.event.EarlyWarningEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;
import java.util.Objects;

/**
* 预警规则触发
*
* @author ZPF
* @return
* @since 2023/08/03 14:19
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class EarlyWarningListener {
private final HistoryService historyService;
private final IProjectInstService projectInstService;

private final IProjectService projectService;

private final IEarlyWarningRecordsService earlyWarningRecordsService;

private final UserInfoHelper userInfoHelper;

@Async
@EventListener
public void onApplicationEvent(EarlyWarningEvent event) {
log.info("进入预警规则触发的 事件监听!");
log.info("event:{}", JSON.toJSONString(event));
String nodeId = event.getNodeId();
Integer timeout = event.getTimeout();
String noticeMethod = event.getNoticeMethod();
String noticeContent = event.getNoticeContent();

//1.根据nodeId 查询到 node 去查找 未完成 项目实例关系表 找到实例
List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery()
.activityId(nodeId)
.unfinished()
.orderByHistoricActivityInstanceStartTime()
.asc()
.list();

if (CollUtil.isEmpty(hais)) {
log.info("没有查到 历史实例");
return;
}

String instanceId = hais.get(0).getProcessInstanceId();

//查询当前未完成的此实例
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(instanceId)
.unfinished()
.singleResult();

if (Objects.isNull(instance)) {
log.info("没有查到实例 或者 实例已经结束");
return;
}

//2.查到 此流程实例的 项目
ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getInstCode, instanceId)
.last(BizConst.LIMIT_1));

if (Objects.isNull(pi)) {
log.info("没有查到实例项目关联信息");
return;
}

Long projectId = pi.getProjectId();
Project project = projectService.getById(projectId);

if (Objects.isNull(project)) {
log.info("没有查到该项目信息");
return;
}

for(HistoricActivityInstance hai : hais){
String assignee = hai.getAssignee();
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(assignee);
WflowEarlyWarningRecords records = new WflowEarlyWarningRecords();
records.setAreaCode(project.getAreaCode());
records.setBuildOrgCode(project.getBuildOrgCode());
records.setBuildOrgName(project.getBuildOrgName());
records.setCreateOn(LocalDateTime.now());
records.setWarningTime(LocalDateTime.now());
records.setInstStart(hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
records.setInstType(pi.getInstType());
records.setNoticeMethod(noticeMethod);
records.setNoticeContent(convertContent(noticeContent,project.getProjectName(),InstTypeEnum.getByCode(pi.getInstType()),timeout));
records.setProjectName(project.getProjectName());
records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode());
records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY);
records.setWarningEmployeecode(assignee);
earlyWarningRecordsService.save(records);
}
}

/**
* 转换出 通知的内容
* @param noticeContent
* @param projectName
* @param instTypeEnum
* @param timeout
* @return
*/
private String convertContent(String noticeContent, String projectName, InstTypeEnum instTypeEnum, Integer timeout) {
noticeContent = noticeContent.replace("{projectName}",projectName)
.replace("{flowType}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{flowType}")
.replace("{time}",String.valueOf(timeout));
log.info("通知内容 :{}",noticeContent);
return noticeContent;
}
}

+ 56
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java View File

@@ -0,0 +1,56 @@
package com.ningdatech.pmapi.sys.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.sys.model.req.WarningListReq;
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO;
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService;
import com.wflow.bean.dto.WflowEarlyWarningDTO;
import com.wflow.bean.vo.WflowEarlyWarningVO;
import com.wflow.service.IEarlyWarningService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* @Classname EarlyWarningController
* @Description
* @Date 2023/8/01 14:28
* @Author PoffyZhang
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/api/v1/sys/early-warning")
@Api(value = "EarlyWarning", tags = "预警管理")
@RequiredArgsConstructor
public class EarlyWarningController {

private final IEarlyWarningService earlyWarningService;

private final IEarlyWarningRecordsService earlyWarningRecordsService;

@ApiOperation(value = "预警规则获取", notes = "预警规则获取")
@GetMapping("/detail/{areaCode}")
public List<WflowEarlyWarningVO> detail(@PathVariable String areaCode) {
return earlyWarningService.detailByRegion(areaCode);
}

@ApiOperation(value = "预警规则保存", notes = "预警规则保存")
@PostMapping("/save")
@WebLog("预警规则保存")
public String save(@Validated @RequestBody WflowEarlyWarningDTO dto) {
return earlyWarningService.saveByDto(dto);
}

@ApiOperation(value = "预警记录查询", notes = "预警记录查询")
@GetMapping("/records/{ruleType}")
public PageVo<WflowEarlyWarningRecordsVO> records(@PathVariable Integer ruleType, WarningListReq req) {
return earlyWarningRecordsService.records(ruleType,req);
}
}

+ 17
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/EarlyWarningRecordsMapper.java View File

@@ -0,0 +1,17 @@
package com.ningdatech.pmapi.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords;
import org.springframework.stereotype.Repository;

/**
* <p>
* Mapper 接口
* </p>
*
* @author PoffyZhang
*/
@Repository
public interface EarlyWarningRecordsMapper extends BaseMapper<WflowEarlyWarningRecords> {

}

+ 108
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java View File

@@ -0,0 +1,108 @@
package com.ningdatech.pmapi.sys.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* 实体类
* 角色分配
* 预警触发通知记录
* @author PoffyZhang
*/
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
@TableName("wflow_early_warning_records")
@ApiModel(value = "WflowEarlyWarningRecords", description = "预警触发通知记录")
public class WflowEarlyWarningRecords implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Long id;

/**
* 区域CODE
*/
@ApiModelProperty(value = "区域CODE")
private String areaCode;

/**
* 项目名称
*/
@ApiModelProperty(value = "项目名称")
private String projectName;


/**
* 流程类型
*/
@ApiModelProperty(value = "流程类型")
private Integer instType;

/**
* 任务开始时间
*/
@ApiModelProperty(value = "任务开始时间")
private LocalDateTime instStart;

/**
* 预警时间
*/
@ApiModelProperty(value = "预警时间")
private LocalDateTime warningTime;

/**
* 通知人名
*/
@ApiModelProperty(value = "通知人名")
private String warningUsername;

/**
* 预警员工号
*/
@ApiModelProperty(value = "预警员工号")
private String warningEmployeecode;

/**
* 通知方式
*/
@ApiModelProperty(value = "通知方式 0浙政钉 1短信 逗号分隔")
private String noticeMethod;

/**
* 通知内容
*/
@ApiModelProperty(value = "通知内容")
private String noticeContent;

/**
* 申报单位
*/
@ApiModelProperty(value = "申报单位CODE")
private String buildOrgCode;
@ApiModelProperty(value = "申报单位")
private String buildOrgName;

/**
* 规则
*/
@ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督")
private Integer ruleType;


private LocalDateTime createOn;

}

+ 35
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java View File

@@ -0,0 +1,35 @@
package com.ningdatech.pmapi.sys.model.req;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
* <p>
* WarningListReq
* </p>
*
* @author ZPF
* @since 00:32 2022/7/23
*/
@Data
@ApiModel("预警记录查询参数类")
@EqualsAndHashCode(callSuper = true)
public class WarningListReq extends PagePo {

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报单位")
private String buildOrgName;

@ApiModelProperty("提醒开始时间")
private LocalDateTime startTime;

@ApiModelProperty("提醒结束时间")
private LocalDateTime endTime;
}

+ 128
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java View File

@@ -0,0 +1,128 @@
package com.ningdatech.pmapi.sys.model.vo;

import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.wflow.enums.WarningRuleTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
* 实体类
* 角色分配
* 预警触发通知记录
* @author PoffyZhang
*/
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
@ApiModel(value = "WflowEarlyWarningRecords", description = "预警触发通知记录")
public class WflowEarlyWarningRecordsVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "id")
private Long id;

/**
* 区域CODE
*/
@ApiModelProperty(value = "区域CODE")
private String areaCode;

/**
* 项目名称
*/
@ApiModelProperty(value = "项目名称")
private String projectName;


/**
* 流程类型
*/
@ApiModelProperty(value = "流程类型")
private Integer instType;

/**
* 任务开始时间
*/
@ApiModelProperty(value = "任务开始时间")
private LocalDateTime instStart;

/**
* 预警时间
*/
@ApiModelProperty(value = "预警时间")
private LocalDateTime warningTime;

/**
* 通知人名
*/
@ApiModelProperty(value = "通知人名")
private String warningUsername;

/**
* 预警员工号
*/
@ApiModelProperty(value = "预警员工号")
private String warningEmployeecode;

/**
* 通知方式
*/
@ApiModelProperty(value = "通知方式 0浙政钉 1短信 逗号分隔")
private String noticeMethod;

/**
* 通知内容
*/
@ApiModelProperty(value = "通知内容")
private String noticeContent;

/**
* 申报单位
*/
@ApiModelProperty(value = "申报单位CODE")
private String buildOrgCode;
@ApiModelProperty(value = "申报单位")
private String buildOrgName;

/**
* 规则
*/
@ApiModelProperty(value = "规则类型 1.流程预警规则 2.填报预警规则 3.实施监督")
private Integer ruleType;


private LocalDateTime createOn;
private String createBy;
private LocalDateTime updateOn;
private String updateBy;

public String getInstTypeName(){
if(Objects.nonNull(this.instType)){
InstTypeEnum instEnum = InstTypeEnum.getByCode(this.instType);
if(Objects.nonNull(instEnum)){
return instEnum.getDesc();
}
}
return StringUtils.EMPTY;
}

public String getRuleTypeName(){
if(Objects.nonNull(this.ruleType)){
WarningRuleTypeEnum warningEnum = WarningRuleTypeEnum.checkByCode(this.instType);
if(Objects.nonNull(warningEnum)){
return warningEnum.getDesc();
}
}
return StringUtils.EMPTY;
}
}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java View File

@@ -0,0 +1,15 @@
package com.ningdatech.pmapi.sys.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords;
import com.ningdatech.pmapi.sys.model.req.WarningListReq;
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO;

/**
* @author PoffyZhang
*/
public interface IEarlyWarningRecordsService extends IService<WflowEarlyWarningRecords> {

PageVo<WflowEarlyWarningRecordsVO> records(Integer ruleType, WarningListReq req);
}

+ 61
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java View File

@@ -0,0 +1,61 @@
package com.ningdatech.pmapi.sys.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.sys.mapper.EarlyWarningRecordsMapper;
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords;
import com.ningdatech.pmapi.sys.model.req.WarningListReq;
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO;
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;


/**
* <p>
* 业务实现类
* 菜单
* </p>
*
* @author ZPF
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class EarlyWarningRecordsServiceImpl extends ServiceImpl<EarlyWarningRecordsMapper, WflowEarlyWarningRecords>
implements IEarlyWarningRecordsService {

@Override
public PageVo<WflowEarlyWarningRecordsVO> records(Integer ruleType, WarningListReq req) {
Page<WflowEarlyWarningRecords> page = req.page();
LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class)
.eq(WflowEarlyWarningRecords::getRuleType, ruleType)
.like(StringUtils.isNotBlank(req.getProjectName()), WflowEarlyWarningRecords::getProjectName, req.getProjectName())
.like(StringUtils.isNotBlank(req.getBuildOrgName()), WflowEarlyWarningRecords::getBuildOrgName, req.getBuildOrgName())
.ge(Objects.nonNull(req.getStartTime()),WflowEarlyWarningRecords::getWarningTime,req.getStartTime())
.le(Objects.nonNull(req.getEndTime()),WflowEarlyWarningRecords::getWarningTime,req.getEndTime())
.orderByDesc(WflowEarlyWarningRecords::getCreateOn);

this.page(page,wrapper);

if(0L == page.getTotal()){
return PageVo.empty();
}

List<WflowEarlyWarningRecordsVO> res = page.getRecords().stream()
.map(p -> BeanUtil.copyProperties(p,WflowEarlyWarningRecordsVO.class))
.collect(Collectors.toList());

return PageVo.of(res,page.getTotal());
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java View File

@@ -157,6 +157,18 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails {
return Boolean.FALSE;
}

public Boolean getRegionAdmin() {
if (CollUtil.isNotEmpty(this.userRoleList)) {
for (Role role : this.userRoleList) {
RoleEnum roleEnum = RoleEnum.mathByName(role.getCode());
if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.REGION_MANAGER.name())) {
return Boolean.TRUE;
}
}
}
return Boolean.FALSE;
}

public Boolean getIsMunicipalOrg() {
//如果是丽水市本级的code 就是
if (RegionConst.RC_LS.equals(this.regionCode)) {


Loading…
Cancel
Save