diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java index 287cb64..320cb90 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java @@ -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 = " 已在其他当前评价计划其他分组中,请勿重复添加!"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java index daa00bf..91060e9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java @@ -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 { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java index 044d908..1cf9af9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJNAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJNAction.java index ffa8ae0..868d2f8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJNAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJNAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJYAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJYAction.java index eb1ab5d..e5b4081 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJYAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareJYAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareKFBAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareKFBAction.java index bff3743..a72963f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareKFBAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareKFBAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLDAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLDAction.java index 8fbcf3a..7ac6a59 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLDAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLDAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLQAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLQAction.java index f87fa91..4c6e792 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLQAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareLQAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQTAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQTAction.java index 9c4a19a..6d127ac 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQTAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQTAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQYAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQYAction.java index 4117798..9906c7d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQYAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareQYAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSBJAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSBJAction.java index 466fb16..b83c62a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSBJAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSBJAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSCAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSCAction.java index d1351c6..c5e6db5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSCAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSCAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSYAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSYAction.java index 0f54f1f..e515925 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSYAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareSYAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java index 4d78f52..9fe7b1b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/action/ProjectDeclareYHAction.java @@ -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 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 message) { + Project project = (Project) message.getHeaders().get(PROJECT_DECLARE); project.setStatus(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java index 0ef1da6..6699f8a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJNBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java index 342220b..0e1e70b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineJYBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java index f25cacb..a9c54d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineKFQBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java index 1b5f4fa..575ff1a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLDBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java index e6dfb16..737d7f5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineLQBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java index 2656ba4..43dae81 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQTBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java index e65d761..617c7d7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineQYBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java index 40d38b4..c321412 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSBJBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java index f432e34..eddf681 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSCBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java index 9a7b257..048aac5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineSYBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java index cb7b103..e7bbd74 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/statemachine/builder/ProjectDeclareStateMachineYHBuilder.java @@ -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) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java index 53c5f02..a58f952 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java @@ -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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java index c501e1c..fc9bff3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/PerformanceAppraisalPlanController.java @@ -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 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 applicationList(PerformanceAppraisalListReq req) { + return performanceAppraisalPlanManage.applicationList(req); + } + + @GetMapping("/project-list") + @ApiOperation("项目分组-评价计划内待评价项目列表") + public PageVo projectList(PerformanceAppraisalListReq req) { + return performanceAppraisalPlanManage.projectList(req); + } + @GetMapping("/group/list/{appraisalId}") @ApiOperation("绩效评价分组列表") public List groupList(@PathVariable Long appraisalId, diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java index e31be2e..d3095a6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/convert/PerformanceAppraisalConveter.java @@ -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 convertApplications( - List applications, Map map) { + List applications, Map 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; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/EvalObjectEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/EvalObjectEnum.java new file mode 100644 index 0000000..8cbd684 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/EvalObjectEnum.java @@ -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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java index 879c2e5..82e03fb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/PerformanceTemplateTypeEnum.java @@ -22,7 +22,6 @@ public enum PerformanceTemplateTypeEnum { /** * 模板类型 */ - //STAGE(0, "阶段"), FIRST_INDEX(1, "第一指标"), SECOND_INDEX(2, "第二指标"), THIRD_INDEX(3, "第三指标"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java index 35b1c59..30f3c57 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/OrgSelfAppraisalManage.java @@ -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 userRoleList = user.getUserRoleList(); + List 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 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 projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList()); - + // 获取添加过该单位项目的所有评价计划信息 List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .in(PerformanceAppraisalProject::getProjectId, projectIds)); if(CollUtil.isEmpty(paps)){ return PageVo.empty(); } - Set paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); - + // 获取评价计划列表 Page page = req.page(); LambdaQueryWrapper 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 res = page.getRecords().stream().map(p -> { - PerformanceAppraisalVO vo = BeanUtil.copyProperties(p,PerformanceAppraisalVO.class); - return vo; - }).collect(Collectors.toList()); + List 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 paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())); + Map papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); if(CollUtil.isEmpty(paps)){ return PageVo.empty(); } - Set projectIds = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + // 获取本单位在当前评价计划内的项目 + Set projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); Page page = req.page(); LambdaQueryWrapper 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 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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java index a47a31f..4b705b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/PerformanceAppraisalPlanManage.java @@ -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 list(PerformanceAppraisalListReq req) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String regionCode = userDetail.getRegionCode(); Page page = req.page(); LambdaQueryWrapper 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 groupList = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId, id)); + // 对计划内待评价项目进行了分组 + if (CollUtil.isNotEmpty(groupList)){ + // 获取分组信息 + List 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 reAppraisalUsers = Arrays.stream(reAppraisalUsersStr.split(StrPool.COMMA)) + .map(userInfoHelper::getUserFullInfoByEmployeeCode).collect(Collectors.toList()); + groupVo.setReAppraisalUsers(reAppraisalUsers); + String verificationUsersStr = g.getVerificationUsers(); + List 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 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 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 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 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 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 paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, id)); + performanceAppraisalProjectService.removeBatchByIds(paps); + // 删除评价计划关联的应用 + //绩效关联的应用 + List 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 groupList(Long appraisalId,String name) { List 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 projectMap = Maps.newHashMap(); List 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 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 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 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 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 projectCodes, List projectCodeList) { + // 判断选择的项目是否已经在当前评价计划的其他分组内 + // 如果提交的项目在该评价计划其他分组中 + if (!CollectionUtil.intersection(projectCodes,projectCodeList).isEmpty()){ + ArrayList 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 checkUsers, List compareUsers, Integer type) { + // 如果提交的复评/核查人员在该评价计划其他分组中 + if (!CollectionUtil.intersection(checkUsers,compareUsers).isEmpty()){ + ArrayList 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 applicationList(PerformanceAppraisalListReq req) { + Page page = req.page(); + // 获取登录用户所在区域已验收项目 + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String regionCode = user.getRegionCode(); + List projects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getAreaCode,regionCode) + .eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) + .eq(Project::getNewest, Boolean.TRUE)); + // 获取已验收项目关联的应用信息 + List projectVersions = projects.stream().map(Project::getVersion).collect(Collectors.toList()); + List projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); + LambdaQueryWrapper 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 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 projectIdList = addDTO.getProjectIds(); + if (CollUtil.isEmpty(projectIdList)){ + throw new BizException("请选择至少一个评价项目!"); + } + // 获取已经创建的评价计划中添加的评价项目ID + List projectIds = performanceAppraisalProjectService.list().stream() + .map(PerformanceAppraisalProject::getProjectId).collect(Collectors.toList()); + Long appraisalId = addDTO.getAppraisalId(); + // 如果评价计划不为空,说明是编辑评价计划, + // 评价计划中原来已经勾选的待评价项目,不作为判断重复添加的内容 + if (Objects.nonNull(appraisalId)){ + // 获取当前编辑的评价计划中选择的项目 + List 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 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 applicationIdList = addDTO.getApplicationIds(); + if (CollUtil.isEmpty(applicationIdList)){ + throw new BizException("请选择至少一个评应用!"); + } + // 获取已经创建的评价计划中添加的评价应用ID + List applicationIds = performanceAppraisalApplicationService.list().stream() + .map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); + Long appraisalId = addDTO.getAppraisalId(); + // 如果评价计划不为空,说明是编辑评价计划, + // 评价计划中原来已经勾选的待评价应用,不作为判断重复添加的内容 + if (Objects.nonNull(appraisalId)){ + // 获取当前编辑的评价计划中选择的应用 + List 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 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 idList, List ids) { + return !CollectionUtil.intersection(idList, ids).isEmpty(); + } + + public PageVo projectList(PerformanceAppraisalListReq req) { + Long appraisalId = req.getAppraisalId(); + VUtils.isTrue(Objects.isNull(appraisalId)).throwMessage("未传入评价计划ID"); + String projectName = req.getProjectName(); + String buildOrgName = req.getBuildOrgName(); + // 获取评价计划内的选择的项目信息 + List appraisalProjectList = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId)); + List projectCodes = appraisalProjectList.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + LambdaQueryWrapper 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 projects = projectService.list(wrapper); + if (CollUtil.isEmpty(projects)){ + return PageVo.empty(); + } + List 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()); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AddAppraisalObjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AddAppraisalObjectDTO.java new file mode 100644 index 0000000..2e5cac4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/AddAppraisalObjectDTO.java @@ -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 projectIds; + + @ApiModelProperty("评价应用ids") + private List applicationIds; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java index dd3e2b4..d5e744f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalCreateDTO.java @@ -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 = "评价目标不能为空") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java index 1654133..139cbf0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalEditDTO.java @@ -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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java index a52c803..9a72064 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisal.java @@ -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; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java index fe82b6c..1084386 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalApplication.java @@ -35,6 +35,6 @@ public class PerformanceAppraisalApplication implements Serializable { @ApiModelProperty("计划id") private Long appraisalId; - @ApiModelProperty("应用id") + @ApiModelProperty("应用ID") private Long applicationId; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java index 6de11c4..cebda6d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProject.java @@ -43,4 +43,10 @@ public class PerformanceAppraisalProject implements Serializable { @ApiModelProperty("是否核查") private Boolean isReAppraisal; + + @ApiModelProperty("自评开始时间") + private LocalDateTime selfAppraisalStart; + + @ApiModelProperty("自评结束时间") + private LocalDateTime selfAppraisalEnd; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java index dd6939c..72f4672 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalProjectGroup.java @@ -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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java index 1631390..55b92d9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceIndicatorProjectTemplate.java @@ -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; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java index cbe4d42..4923b6d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/req/PerformanceAppraisalListReq.java @@ -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; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java index a84bf01..c4bba5f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalApplicationVO.java @@ -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; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java index af24f9a..c96768b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectVO.java @@ -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; + + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java index f1e1aaa..f93f321 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalVO.java @@ -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 applications; + + @ApiModelProperty("项目分组信息") + private List groups; + + @ApiModelProperty("终验后 xx 天开始自评") + private Integer startSelfDays; + + @ApiModelProperty("xx 天需完成自评") + private Integer completeSelfDays; + + @ApiModelProperty("备注") + private String remark; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java index 32ec504..a344072 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectIndexTemplateVO.java @@ -55,4 +55,10 @@ public class ProjectIndexTemplateVO implements Serializable { @ApiModelProperty("附加绩效指标详情") private List additionalIndexDetails; + + @ApiModelProperty("项目标签ID") + private Long projectTagId; + + @ApiModelProperty("项目标签名称") + private String projectTagName; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java new file mode 100644 index 0000000..0a46dce --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java @@ -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 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 dtos) { + return tagManage.saveToProject(dtos); + } + + @PostMapping("/remove-tag-to-project") + @ApiOperation("项目删除标签") + @WebLog("项目删除标签") + public String removeTagToProject(@Valid @RequestBody TagToProjectDTO dto) { + return tagManage.removeTagToProject(dto); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java new file mode 100644 index 0000000..75a7998 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java @@ -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 list(String areaCode, TagPageReq req) { + LambdaQueryWrapper 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 page = tagService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), + t -> BeanUtil.copyProperties(t,TagVO.class)); + return PageVo.of(records, total); + } + + /** + * 权限控制 + * @param query + * @param user + */ + private void checkAuth(LambdaQueryWrapper 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 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 "删除失败"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java new file mode 100644 index 0000000..7ee6898 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface ProjectTagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java new file mode 100644 index 0000000..78ed337 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface TagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java new file mode 100644 index 0000000..4cc5a2e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java @@ -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; + +/** + *

+ * 标签 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java new file mode 100644 index 0000000..7bdb8d8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java @@ -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; + +/** + *

+ * 标签 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java new file mode 100644 index 0000000..f399112 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java @@ -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; + +/** + *

+ * 标签项目关联 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java new file mode 100644 index 0000000..df641ae --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java @@ -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; + +/** + *

+ * 标签 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java new file mode 100644 index 0000000..85dfd3f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java @@ -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; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java new file mode 100644 index 0000000..3527f98 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java @@ -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; + +/** + *

+ * 标签 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java new file mode 100644 index 0000000..a400cc5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java @@ -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 { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java new file mode 100644 index 0000000..b635e07 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java @@ -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 { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java new file mode 100644 index 0000000..53bd932 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +@Service +public class ProjectTagServiceImpl extends ServiceImpl implements IProjectTagService { + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java new file mode 100644 index 0000000..142029a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +@Service +public class TagServiceImpl extends ServiceImpl implements ITagService { + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java index 25cbdd1..5779ac6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/ConstructionPlanController.java @@ -46,8 +46,6 @@ public class ConstructionPlanController { return "建设方案申报 【" + instanceId + "】 成功"; } - - @GetMapping("/export") @ApiOperation("可申报建设方案项目列表导出") @WebLog("可申报建设方案项目列表导出") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index fe7bea6..a03920e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -154,7 +154,7 @@ public class DeclaredProjectManage { Project project = new Project(); BeanUtils.copyProperties(projectInfo,project); Map 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); //如果是重新提交的话 判断下 项目是否存在 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java index 8850698..5202441 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java @@ -37,7 +37,6 @@ public class AnnualPlanController { @GetMapping("/list") @ApiOperation("年度计划库列表") - @WebLog("年度计划库列表") public PageVo annualPlanLibList(ProjectListReq req) { return annualPlanLibManage.annulPlanLibList(req); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java index 7ea6617..a5b7123 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java @@ -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; /** diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index cd7651f..338eb5d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -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 projectLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); query.eq(Project::getNewest, Boolean.TRUE); @@ -156,6 +168,25 @@ public class ProjectLibManage { return PageVo.empty(); } UserFullInfoDTO finalUser = user; + + Set projectCodes = page.getRecords().stream() + .map(Project::getProjectCode).collect(Collectors.toSet()); + List pts = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) + .in(ProjectTag::getProjectCode, projectCodes)); + Map> tagMap = Maps.newHashMap(); + Map tagNameMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(pts)){ + tagMap = pts.stream().collect(Collectors.groupingBy(ProjectTag::getProjectCode)); + Set tagIds = pts.stream().map(ProjectTag::getTagId).collect(Collectors.toSet()); + List 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> finalTagMap = tagMap; + Map finalTagNameMap = tagNameMap; + List 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> finalTagMap, Map finalTagNameMap) { + if(finalTagMap.containsKey(item.getProjectCode())){ + List tags = Lists.newArrayList(); + List 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 projectList(ProjectListReq req) { LambdaQueryWrapper 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 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 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 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); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java index edaab44..3936482 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java @@ -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 acceptancePersons; + @ApiModelProperty("实施信息") + private OperationVO operation; + @ApiModelProperty("版本号str") private String versionStr; @@ -395,6 +402,9 @@ public class ProjectDetailVO { @ApiModelProperty("审批详情") private ProcessProgressDetailVo process; + @ApiModelProperty("标签") + private List 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; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java index 20bd972..400263c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java @@ -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 tags; + //预审申报时候 需不需要上传上级条线意见文件 private Boolean needUploadSuperLineFile; public Boolean getNeedUploadSuperLineFile() { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/controller/SafetyRiskController.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/controller/SafetyRiskController.java new file mode 100644 index 0000000..aa4708c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/controller/SafetyRiskController.java @@ -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 personMonitorList(ProjectListReq req) { + return safetyRiskManage.personMonitorList(req); + } + + @PostMapping("/person-monitor/save") + @ApiOperation("安全人员监控信息保存") + @WebLog("安全人员监控信息保存") + public String personMonitorSave(@Valid @RequestBody List dtos) { + return safetyRiskManage.personMonitorSave(dtos); + } + + @PostMapping("/supplier-safety-qualification/save") + @ApiOperation("供应商安全资质保存") + @WebLog("供应商安全资质保存") + public String supplierSafetyQualificationSave(@Valid @RequestBody List 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); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java new file mode 100644 index 0000000..5e990df --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java @@ -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 personMonitorList(ProjectListReq req) { + LambdaQueryWrapper 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 page = projectService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), + p -> BeanUtil.copyProperties(p,ProjectMonitorVO.class)); + return PageVo.of(records, total); + } + + /** + * 权限控制 + * @param query + * @param user + */ + private void checkAuth(LambdaQueryWrapper 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 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 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 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 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 + "条"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/PersonSafetyInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/PersonSafetyInfoMapper.java new file mode 100644 index 0000000..3316418 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/PersonSafetyInfoMapper.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface PersonSafetyInfoMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/SupplierSafetyQualificationMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/SupplierSafetyQualificationMapper.java new file mode 100644 index 0000000..39e897b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/mapper/SupplierSafetyQualificationMapper.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface SupplierSafetyQualificationMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/PersonSafetyInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/PersonSafetyInfoDTO.java new file mode 100644 index 0000000..8527086 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/PersonSafetyInfoDTO.java @@ -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; + +/** + *

+ * 安全人员信息 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/SupplierSafetyQualificationDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/SupplierSafetyQualificationDTO.java new file mode 100644 index 0000000..512d9c7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/dto/SupplierSafetyQualificationDTO.java @@ -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; + +/** + *

+ * 供应商安全资质 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/PersonSafetyInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/PersonSafetyInfo.java new file mode 100644 index 0000000..0b7139e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/PersonSafetyInfo.java @@ -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; + +/** + *

+ * 安全人员信息 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/SupplierSafetyQualification.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/SupplierSafetyQualification.java new file mode 100644 index 0000000..c2632b6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/entity/SupplierSafetyQualification.java @@ -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; + +/** + *

+ * 供应商安全资质 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/PersonSafetyInfoVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/PersonSafetyInfoVO.java new file mode 100644 index 0000000..07c7019 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/PersonSafetyInfoVO.java @@ -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; + +/** + *

+ * 安全人员信息 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/ProjectMonitorVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/ProjectMonitorVO.java new file mode 100644 index 0000000..12419e3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/ProjectMonitorVO.java @@ -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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SafetyMonitorVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SafetyMonitorVO.java new file mode 100644 index 0000000..8ec87f2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SafetyMonitorVO.java @@ -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 personSafetyInfo; + + @ApiModelProperty("供应商安全资质") + private List supplierSafetyQualification; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SupplierSafetyQualificationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SupplierSafetyQualificationVO.java new file mode 100644 index 0000000..ab4943b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/model/vo/SupplierSafetyQualificationVO.java @@ -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; + +/** + *

+ * 供应商安全资质 + *

+ * + * @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; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/IPersonSafetyInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/IPersonSafetyInfoService.java new file mode 100644 index 0000000..885cf5d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/IPersonSafetyInfoService.java @@ -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 { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/ISupplierSafetyQualificationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/ISupplierSafetyQualificationService.java new file mode 100644 index 0000000..d68cca7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/ISupplierSafetyQualificationService.java @@ -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 { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/PersonSafetyInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/PersonSafetyInfoServiceImpl.java new file mode 100644 index 0000000..c0bca50 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/PersonSafetyInfoServiceImpl.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +@Service +public class PersonSafetyInfoServiceImpl extends ServiceImpl implements IPersonSafetyInfoService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/SupplierSafetyQualificationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/SupplierSafetyQualificationServiceImpl.java new file mode 100644 index 0000000..dc3af89 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/service/impl/SupplierSafetyQualificationServiceImpl.java @@ -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; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +@Service +public class SupplierSafetyQualificationServiceImpl extends ServiceImpl implements ISupplierSafetyQualificationService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java new file mode 100644 index 0000000..56aa2e6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java @@ -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 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; + } +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java new file mode 100644 index 0000000..9c36213 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/EarlyWarningController.java @@ -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 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 records(@PathVariable Integer ruleType, WarningListReq req) { + return earlyWarningRecordsService.records(ruleType,req); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/EarlyWarningRecordsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/EarlyWarningRecordsMapper.java new file mode 100644 index 0000000..5c3174f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/mapper/EarlyWarningRecordsMapper.java @@ -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; + +/** + *

+ * Mapper 接口 + *

+ * + * @author PoffyZhang + */ +@Repository +public interface EarlyWarningRecordsMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java new file mode 100644 index 0000000..c130f7f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/WflowEarlyWarningRecords.java @@ -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; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java new file mode 100644 index 0000000..1e8e3a6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java @@ -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; + +/** + *

+ * WarningListReq + *

+ * + * @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; +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java new file mode 100644 index 0000000..e6d8b64 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java @@ -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; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java new file mode 100644 index 0000000..8ebc57c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IEarlyWarningRecordsService.java @@ -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 { + + PageVo records(Integer ruleType, WarningListReq req); +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java new file mode 100644 index 0000000..99ab9a3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java @@ -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; + + +/** + *

+ * 业务实现类 + * 菜单 + *

+ * + * @author ZPF + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class EarlyWarningRecordsServiceImpl extends ServiceImpl + implements IEarlyWarningRecordsService { + + @Override + public PageVo records(Integer ruleType, WarningListReq req) { + Page page = req.page(); + LambdaQueryWrapper 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 res = page.getRecords().stream() + .map(p -> BeanUtil.copyProperties(p,WflowEarlyWarningRecordsVO.class)) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java index c477497..75fec5c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java @@ -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)) {