diff --git a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java index 8493fb0..414a8b0 100644 --- a/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java +++ b/ningda-generator/src/main/java/com/ningdatech/generator/config/GeneratorCodeKingbaseConfig.java @@ -14,7 +14,7 @@ import java.util.Collections; public class GeneratorCodeKingbaseConfig { private static final String PATH_LXX = "/Users/liuxinxin/IdeaProjects/project-management/pmapi/src/main/java"; - private static final String PATH_YYD = "/Users/wendy/coding/java/project-management/pmapi/src/main/java"; + private static final String PATH_YYD = "/Users/wendy/code project/java/project-management/pmapi/src/main/java"; private static final String PATH_LS = ""; private static final String PATH_ZPF = "D:\\ningda\\project-management\\pmapi\\src\\main\\java"; private static final String PATH_CMM = "D:\\work\\project-management\\project-management\\pmapi\\src\\main\\java"; @@ -57,7 +57,7 @@ public class GeneratorCodeKingbaseConfig { public static void main(String[] args) { //generate("Liuxinxin", "expert", PATH_LXX, "expert_gov_business_strip"); - generate("CMM", "meeting", PATH_YYD, "meeting_expert_judge"); + generate("CMM", "test", PATH_CMM, "nd_performance_appraisal_score_info"); } } diff --git a/pmapi/lib/agent-boot-1.3.22.0215.jar b/pmapi/lib/agent-boot-1.3.22.0215.jar new file mode 100644 index 0000000..bee98fb Binary files /dev/null and b/pmapi/lib/agent-boot-1.3.22.0215.jar differ diff --git a/pmapi/lib/commons-compress-1.19.jar b/pmapi/lib/commons-compress-1.19.jar new file mode 100644 index 0000000..5c9f52a Binary files /dev/null and b/pmapi/lib/commons-compress-1.19.jar differ diff --git a/pmapi/lib/commons-io-2.5.jar b/pmapi/lib/commons-io-2.5.jar new file mode 100644 index 0000000..107b061 Binary files /dev/null and b/pmapi/lib/commons-io-2.5.jar differ diff --git a/pmapi/lib/commons-lang-2.6.jar b/pmapi/lib/commons-lang-2.6.jar new file mode 100644 index 0000000..98467d3 Binary files /dev/null and b/pmapi/lib/commons-lang-2.6.jar differ diff --git a/pmapi/lib/commons-lang3-3.8.1.jar b/pmapi/lib/commons-lang3-3.8.1.jar new file mode 100644 index 0000000..2c65ce6 Binary files /dev/null and b/pmapi/lib/commons-lang3-3.8.1.jar differ diff --git a/pmapi/lib/commons-logging-1.1.1.jar b/pmapi/lib/commons-logging-1.1.1.jar new file mode 100644 index 0000000..1deef14 Binary files /dev/null and b/pmapi/lib/commons-logging-1.1.1.jar differ diff --git a/pmapi/lib/dom4j-2.0.2.jar b/pmapi/lib/dom4j-2.0.2.jar new file mode 100644 index 0000000..7039b80 Binary files /dev/null and b/pmapi/lib/dom4j-2.0.2.jar differ diff --git a/pmapi/lib/gson-2.8.0.jar b/pmapi/lib/gson-2.8.0.jar new file mode 100644 index 0000000..1235f63 Binary files /dev/null and b/pmapi/lib/gson-2.8.0.jar differ diff --git a/pmapi/lib/httpclient-4.5.13.jar b/pmapi/lib/httpclient-4.5.13.jar new file mode 100644 index 0000000..218ee25 Binary files /dev/null and b/pmapi/lib/httpclient-4.5.13.jar differ diff --git a/pmapi/lib/httpcore-4.4.13.jar b/pmapi/lib/httpcore-4.4.13.jar new file mode 100644 index 0000000..163dc43 Binary files /dev/null and b/pmapi/lib/httpcore-4.4.13.jar differ diff --git a/pmapi/lib/httpmime-4.5.13.jar b/pmapi/lib/httpmime-4.5.13.jar new file mode 100644 index 0000000..cc52f44 Binary files /dev/null and b/pmapi/lib/httpmime-4.5.13.jar differ diff --git a/pmapi/lib/jbArchivesTools-1.0-SNAPSHOT.jar b/pmapi/lib/jbArchivesTools-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..460fca6 Binary files /dev/null and b/pmapi/lib/jbArchivesTools-1.0-SNAPSHOT.jar differ diff --git a/pmapi/lib/ofd-simple-tool-1.0.23.0324.jar b/pmapi/lib/ofd-simple-tool-1.0.23.0324.jar new file mode 100644 index 0000000..a3eaea3 Binary files /dev/null and b/pmapi/lib/ofd-simple-tool-1.0.23.0324.jar differ diff --git a/pmapi/lib/slf4j-api-1.7.29.jar b/pmapi/lib/slf4j-api-1.7.29.jar new file mode 100644 index 0000000..81ed475 Binary files /dev/null and b/pmapi/lib/slf4j-api-1.7.29.jar differ diff --git a/pmapi/lib/slf4j-simple-1.7.26.jar b/pmapi/lib/slf4j-simple-1.7.26.jar new file mode 100644 index 0000000..5d82cdf Binary files /dev/null and b/pmapi/lib/slf4j-simple-1.7.26.jar differ diff --git a/pmapi/lib/suwell-agent-http-1.7.220630.jar b/pmapi/lib/suwell-agent-http-1.7.220630.jar new file mode 100644 index 0000000..0873d69 Binary files /dev/null and b/pmapi/lib/suwell-agent-http-1.7.220630.jar differ diff --git a/pmapi/lib/suwell-agent-wrapper-1.6.221208.jar b/pmapi/lib/suwell-agent-wrapper-1.6.221208.jar new file mode 100644 index 0000000..374c378 Binary files /dev/null and b/pmapi/lib/suwell-agent-wrapper-1.6.221208.jar differ diff --git a/pmapi/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar b/pmapi/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar new file mode 100644 index 0000000..9218cde Binary files /dev/null and b/pmapi/lib/suwell-bank-extend-1.8.28.0627-sgcc.jar differ diff --git a/pmapi/lib/suwell-convert-base-1.5.19.0408.jar b/pmapi/lib/suwell-convert-base-1.5.19.0408.jar new file mode 100644 index 0000000..67469ef Binary files /dev/null and b/pmapi/lib/suwell-convert-base-1.5.19.0408.jar differ diff --git a/pmapi/lib/suwell-core-base-1.7.220623-lite.jar b/pmapi/lib/suwell-core-base-1.7.220623-lite.jar new file mode 100644 index 0000000..453c0c9 Binary files /dev/null and b/pmapi/lib/suwell-core-base-1.7.220623-lite.jar differ diff --git a/pmapi/lib/suwell-extend-1.0.22.0804.jar b/pmapi/lib/suwell-extend-1.0.22.0804.jar new file mode 100644 index 0000000..82b6c26 Binary files /dev/null and b/pmapi/lib/suwell-extend-1.0.22.0804.jar differ diff --git a/pmapi/lib/suwell-packet-wrapper-1.21.230306.jar b/pmapi/lib/suwell-packet-wrapper-1.21.230306.jar new file mode 100644 index 0000000..a85805d Binary files /dev/null and b/pmapi/lib/suwell-packet-wrapper-1.21.230306.jar differ diff --git a/pmapi/lib/suwell-rpc-manager-client-2.7.211125.jar b/pmapi/lib/suwell-rpc-manager-client-2.7.211125.jar new file mode 100644 index 0000000..1c9351b Binary files /dev/null and b/pmapi/lib/suwell-rpc-manager-client-2.7.211125.jar differ diff --git a/pmapi/pom.xml b/pmapi/pom.xml index 3be8a63..ee19743 100644 --- a/pmapi/pom.xml +++ b/pmapi/pom.xml @@ -260,7 +260,117 @@ cn.afterturn easypoi-base + + com.agent + agent-boot + 1.3.22 + system + ${project.basedir}/lib/agent-boot-1.3.22.0215.jar + + + + com.agent + agent-boot + 1.3.22 + system + ${project.basedir}/lib/agent-boot-1.3.22.0215.jar + + + + com.suwell + suwell-agent-http + 1.7 + system + ${project.basedir}/lib/suwell-agent-http-1.7.220630.jar + + + + com.suwell + suwell-agent-wrapper + 1.6 + system + ${project.basedir}/lib/suwell-agent-wrapper-1.6.221208.jar + + + + com.slf4j + slf4j-api + 1.7.29 + system + ${project.basedir}/lib/slf4j-api-1.7.29.jar + + + + com.httpclient + httpclient + 4.5.13 + system + ${project.basedir}/lib/httpclient-4.5.13.jar + + + + com.httpcore + httpcore + 4.4.13 + system + ${project.basedir}/lib/httpcore-4.4.13.jar + + + com.httpmime + httpmime + 4.5.13 + system + ${project.basedir}/lib/httpmime-4.5.13.jar + + + + com.jbArchivesTools + jbArchivesTools + 1.0 + system + ${project.basedir}/lib/jbArchivesTools-1.0-SNAPSHOT.jar + + + + com.suwell + suwell-convert-base + 1.5.19 + system + ${project.basedir}/lib/suwell-convert-base-1.5.19.0408.jar + + + + com.gson + gson + 2.8.0 + system + ${project.basedir}/lib/gson-2.8.0.jar + + + + com.suwell + suwell-rpc-manager-client + 2.7 + system + ${project.basedir}/lib/suwell-rpc-manager-client-2.7.211125.jar + + + + com.suwell + suwell-packet-wrapper + 1.21 + system + ${project.basedir}/lib/suwell-packet-wrapper-1.21.230306.jar + + + + com.dom4j + dom4j + 2.0.2 + system + ${project.basedir}/lib/dom4j-2.0.2.jar + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java index 4cc394b..3378b10 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java @@ -90,4 +90,6 @@ public interface BizConst { String ORG_CODE = "organizationCode"; String DEV = "dev"; + String PRE = "pre"; + String PROD = "prod"; } 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/enumeration/CommonEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java index b4c5c10..be73781 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/CommonEnum.java @@ -26,7 +26,9 @@ public enum CommonEnum { LS_QY(331126,"庆元县",2), LS_JN(331127,"景宁畲族自治县",2), LS_LQ(331181,"龙泉市",2), - LS_KFQ(331199,"开发区",2); + LS_KFQ(331199,"开发区",2), + ZWDD(0,"浙政钉",3), + MOBILE(1,"短信",3); private Integer code; private String desc; 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 ad76321..f9539dd 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 @@ -30,7 +30,12 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; "com.ningdatech.pmapi.ding.controller", "com.ningdatech.pmapi.filemanage.controller", "com.ningdatech.pmapi.performance.controller", - "com.ningdatech.pmapi.irs.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", + "com.ningdatech.pmapi.wps.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..1498589 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,15 @@ 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..d77704f 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,16 @@ 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/dashboard/constant/AnalysisBasicConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java new file mode 100644 index 0000000..17c455e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/AnalysisBasicConstant.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.dashboard.constant; + +/** + * @author liuxinxin + * @date 2023/8/2 下午2:46 + */ + +public class AnalysisBasicConstant { + + + /** + * 丽水市区域编码 + */ + public static final String LS_REGION_CODE = "331100"; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java new file mode 100644 index 0000000..cdcb0ec --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/constant/ChartTypeEnum.java @@ -0,0 +1,65 @@ +package com.ningdatech.pmapi.dashboard.constant; + +/** + * @author liuxinxin + * @date 2023/8/2 下午2:52 + */ + +public enum ChartTypeEnum { + + /** + * 各区域专家数量分布 + */ + REGION_EXPERT_NUMBER_CHART, + + /** + * 各区域专家学历分布 + */ + REGION_EXPERT_EDUCATION_CHART, + + /** + * 各区域专家职称级别分布 + */ + REGION_EXPERT_TITLE_LEVEL_CHART, + + /** + * 各类型评审次数 + */ + MEETING_TYPE_CNT_CHART, + + /** + * 项目增补情况 + */ + PROJECT_SUPPLEMENTATION_STATUS_CHART, + + /** + * 各类型项目数量 + */ + EACH_TYPE_QUANTITY_OF_PROJECT_CHART, + + /** + * 各区域项目数量 + */ + PROJECTS_NUMBER_IN_EACH_REGION_CHART, + + /** + * 各领域项目数量 + */ + PROJECTS_NUMBER_IN_VARIOUS_FIELDS_CHART, + + /** + * 各阶段项目数量 + */ + PROJECTS_NUMBER_IN_EACH_STAGE_CHART, + + /** + * 各领域项目投资金额 + */ + PROJECTS_INVESTMENT_AMOUNT_IN_VARIOUS_FIELDS_CHART, + + /** + * 各区域项目投资情况 + */ + PROJECTS_INVESTMENT_SITUATION_IN_VARIOUS_REGIONS + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java new file mode 100644 index 0000000..f5a93fe --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/controller/DashboardController.java @@ -0,0 +1,65 @@ +package com.ningdatech.pmapi.dashboard.controller; + +import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.dashboard.manage.DashboardExpertManage; +import com.ningdatech.pmapi.dashboard.manage.DashboardProjectManage; +import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; +import com.ningdatech.pmapi.dashboard.model.vo.DashboardInvestmentSummaryVO; +import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectCntSummaryVO; +import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectSummaryVO; +import com.ningdatech.pmapi.dashboard.model.vo.ExpertDashboardSummaryVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * @author liuxinxin + * @date 2023/8/2 上午10:36 + */ + +@RestController +@RequestMapping("/api/v1/dashboard") +@Validated +@RequiredArgsConstructor +@Api(value = "DashboardController", tags = "驾驶舱相关接口") +public class DashboardController { + + private final DashboardExpertManage dashboardExpertManage; + private final DashboardProjectManage dashboardProjectManage; + + @PostMapping("/expert-summary") + @ApiOperation("专家驾驶舱统计数据") + @WebLog("专家驾驶舱统计数据") + public ExpertDashboardSummaryVO getExpertDashboardSummary(@Valid @RequestBody QueryYearPO queryYearPO) { + return dashboardExpertManage.getExpertDashboardSummary(queryYearPO); + } + + @PostMapping("project-summary") + @ApiOperation("驾驶舱项目总览") + @WebLog("驾驶舱项目总览") + public DashboardProjectSummaryVO getProjectSummary(@Valid @RequestBody QueryYearPO queryYearPO) { + return dashboardProjectManage.getProjectSummary(queryYearPO); + } + + @PostMapping("project-cnt-summary") + @ApiOperation("驾驶舱项目数量") + @WebLog("驾驶舱项目数量") + public DashboardProjectCntSummaryVO getProjectCntSummary(@Valid @RequestBody QueryYearPO queryYearPO) { + return dashboardProjectManage.getProjectCntSummary(queryYearPO); + } + + @PostMapping("investment-summary") + @ApiOperation("驾驶舱投资金额") + @WebLog("驾驶舱投资金额") + public DashboardInvestmentSummaryVO getInvestmentSummary(@Valid @RequestBody QueryYearPO queryYearPO) { + return dashboardProjectManage.getInvestmentSummary(queryYearPO); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java new file mode 100644 index 0000000..749f350 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardChartAssembler.java @@ -0,0 +1,106 @@ +package com.ningdatech.pmapi.dashboard.helper; + +import cn.hutool.core.collection.CollUtil; +import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisData; +import com.ningdatech.pmapi.meta.helper.DictionaryCache; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @author liuxinxin + * @date 2023/8/4 下午2:36 + */ + +@Component +@RequiredArgsConstructor +public class DashboardChartAssembler { + + private final DictionaryCache dictionaryCache; + + + public static AnalysisChart buildProjectStateAnalysisChart(Map> projectGroupMap, ChartTypeEnum chartTypeEnum) { + AnalysisChart analysisChart = new AnalysisChart(); + List dataList = new ArrayList<>(); + analysisChart.setChartType(chartTypeEnum); + analysisChart.setDataList(dataList); + for (Integer key : projectGroupMap.keySet()) { + AnalysisData analysisData = new AnalysisData(); + String chartKey = ProjectStatusEnum.getDesc(key); + List projectList = projectGroupMap.get(key); + analysisData.setKey(chartKey); + analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size()); + dataList.add(analysisData); + } + return analysisChart; + } + + public static AnalysisChart buildInvestmentAnalysisChart(Map keyValueMap + , Map> projectGroupMap, ChartTypeEnum chartTypeEnum) { + AnalysisChart analysisChart = new AnalysisChart(); + List dataList = new ArrayList<>(); + analysisChart.setChartType(chartTypeEnum); + analysisChart.setDataList(dataList); + for (T key : keyValueMap.keySet()) { + AnalysisData analysisData = new AnalysisData(); + String chartKey = keyValueMap.get(key); + List projectList = projectGroupMap.get(key); + + BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0"); + if (CollUtil.isNotEmpty(projectList)) { + for (Project project : projectList) { + BigDecimal approvedTotalInvestmentIncrease = project.getApprovedTotalInvestmentIncrease(); + if (Objects.nonNull(approvedTotalInvestmentIncrease)) { + approvedTotalInvestmentIncreaseSum.add(approvedTotalInvestmentIncrease); + } + } + } + analysisData.setKey(chartKey); + analysisData.setValue(approvedTotalInvestmentIncreaseSum); + dataList.add(analysisData); + } + return analysisChart; + } + + public static AnalysisChart buildAnalysisChart(Map keyValueMap + , Map> projectGroupMap, ChartTypeEnum chartTypeEnum) { + AnalysisChart analysisChart = new AnalysisChart(); + List dataList = new ArrayList<>(); + analysisChart.setChartType(chartTypeEnum); + analysisChart.setDataList(dataList); + for (T key : keyValueMap.keySet()) { + AnalysisData analysisData = new AnalysisData(); + String chartKey = keyValueMap.get(key); + List projectList = projectGroupMap.get(key); + analysisData.setKey(chartKey); + analysisData.setValue(CollUtil.isEmpty(projectList) ? 0 : projectList.size()); + dataList.add(analysisData); + } + return analysisChart; + } + + public AnalysisChart assemblerAnalysisChart(Map> dictionaryCodeIdMap + , ChartTypeEnum chartTypeEnum) { + AnalysisChart analysisChart = new AnalysisChart(); + List dataList = new ArrayList<>(); + analysisChart.setChartType(chartTypeEnum); + analysisChart.setDataList(dataList); + + for (String dictionaryCode : dictionaryCodeIdMap.keySet()) { + AnalysisData analysisData = new AnalysisData(); + analysisData.setKey(dictionaryCache.getByCode(dictionaryCode).getName()); + analysisData.setValue(dictionaryCodeIdMap.get(dictionaryCode).size()); + dataList.add(analysisData); + } + return analysisChart; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java new file mode 100644 index 0000000..738cac3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/helper/DashboardHelper.java @@ -0,0 +1,77 @@ +package com.ningdatech.pmapi.dashboard.helper; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.dashboard.constant.AnalysisBasicConstant; +import com.ningdatech.pmapi.sys.model.entity.Region; +import com.ningdatech.pmapi.sys.service.IRegionService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/8/3 下午3:13 + */ + +@Component +@RequiredArgsConstructor +public class DashboardHelper { + + private final IRegionService iRegionService; + + /** + * 获取丽水区域相关信息 + */ + public Map getLiShuiRegionCodeNameMap() { + List regionList = iRegionService.list(Wrappers.lambdaQuery(Region.class) + .eq(Region::getParentCode, AnalysisBasicConstant.LS_REGION_CODE)); + Map regionCodeNameMap = regionList.stream().collect(Collectors.toMap(Region::getRegionCode, Region::getRegionName)); + return regionCodeNameMap; + } + + /** + * 获取增补情况键值表 + */ + public Map getTemporaryAugmentMap() { +// 0:否 1:是 + Map map = new HashMap<>(); + map.put(1, "增补项目"); + map.put(0, "非增补项目"); + return map; + } + + + /** + * 获取项目类型键值表 + */ + public Map getProjectTypeMap() { + // "项目类型 1:建设 2:运维 + Map map = new HashMap<>(); + map.put(1, "建设"); + map.put(2, "运维"); + return map; + } + + /** + * 获取项目类型键值表 + */ + public Map getBizDomainMap() { + // 综合业务领域 1: '党政机关整体智治',2: '数字政府',3: '数字经济',4: '数字社会',7: '数字文化',5: '数字法治',6: '一体化智能化公共数据平台', 8: '基层智治' + Map map = new HashMap<>(); + map.put(1, "党政机关整体智治"); + map.put(2, "数字政府"); + map.put(3, "数字经济"); + map.put(4, "数字社会"); + map.put(5, "数字文化"); + map.put(6, "数字法治"); + map.put(7, "一体化智能化公共数据平台"); + map.put(8, "基层智治"); + return map; + } + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java new file mode 100644 index 0000000..d53a236 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardExpertManage.java @@ -0,0 +1,168 @@ +package com.ningdatech.pmapi.dashboard.manage; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; +import com.ningdatech.pmapi.dashboard.helper.DashboardChartAssembler; +import com.ningdatech.pmapi.dashboard.helper.DashboardHelper; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisData; +import com.ningdatech.pmapi.dashboard.model.basic.StarExpertBO; +import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; +import com.ningdatech.pmapi.dashboard.model.vo.ExpertDashboardSummaryVO; +import com.ningdatech.pmapi.expert.constant.ExpertUserInfoStepEnum; +import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; +import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; +import com.ningdatech.pmapi.meeting.entity.domain.Meeting; +import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpertJudge; +import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; +import com.ningdatech.pmapi.meeting.service.IMeetingExpertJudgeService; +import com.ningdatech.pmapi.meeting.service.IMeetingService; +import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; +import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; +import com.ningdatech.pmapi.meta.service.IExpertDictionaryService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/8/2 上午10:39 + */ + +@Component +@RequiredArgsConstructor +public class DashboardExpertManage { + + private final DashboardHelper dashboardHelper; + private final IExpertUserFullInfoService iExpertUserFullInfoService; + private final IMeetingService iMeetingService; + // private final DictionaryCache dictionaryCache; + private final IMeetingExpertJudgeService iMeetingExpertJudgeService; + private final IExpertDictionaryService iExpertDictionaryService; + private final DashboardChartAssembler dashboardChartAssembler; + + + public ExpertDashboardSummaryVO getExpertDashboardSummary(QueryYearPO queryYearPO) { + String queryRegionCode = queryYearPO.getRegionCode(); + List analysisChartList = new ArrayList<>(); + + // 获取丽水区域 code name Map + Map liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap(); + // 获取库内所有的专家列表 + List evidenceHasBeenSubmittedExpertInfoList = iExpertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) + .eq(ExpertUserFullInfo::getUserInfoStep, ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey())); + + // 专家regionCode分组map列表 + Map> regionCodeExpertMap = evidenceHasBeenSubmittedExpertInfoList.stream() + .collect(Collectors.groupingBy(ExpertUserFullInfo::getRegionCode)); + + // 各区域专家数量 + AnalysisChart regionExpertNumberChartAnalysisChart = new AnalysisChart(); + List regionExpertNumberChartDataList = new ArrayList<>(); + regionExpertNumberChartAnalysisChart.setChartType(ChartTypeEnum.REGION_EXPERT_NUMBER_CHART); + regionExpertNumberChartAnalysisChart.setDataList(regionExpertNumberChartDataList); + for (String regionCode : liShuiRegionCodeNameMap.keySet()) { + AnalysisData analysisData = new AnalysisData(); + String regionName = liShuiRegionCodeNameMap.get(regionCode); + List expertUserFullInfoList = regionCodeExpertMap.get(regionCode); + Integer expertCnt = 0; + if (CollectionUtil.isNotEmpty(expertUserFullInfoList)) { + expertCnt = expertUserFullInfoList.size(); + } + analysisData.setKey(regionName); + analysisData.setValue(expertCnt); + regionExpertNumberChartDataList.add(analysisData); + } + analysisChartList.add(regionExpertNumberChartAnalysisChart); + + // 查询区域的专家id 列表 + List regionDegreeExpertIdList = new ArrayList<>(); + if (StringUtils.isNotBlank(queryRegionCode)) { + List expertUserFullInfoList = regionCodeExpertMap.get(queryRegionCode); + if (CollectionUtil.isNotEmpty(expertUserFullInfoList)) { + regionDegreeExpertIdList = expertUserFullInfoList.stream() + .map(ExpertUserFullInfo::getUserId) + .collect(Collectors.toList()); + } + } else { + regionDegreeExpertIdList = evidenceHasBeenSubmittedExpertInfoList.stream() + .map(ExpertUserFullInfo::getUserId) + .collect(Collectors.toList()); + } + + if (CollectionUtil.isNotEmpty(regionDegreeExpertIdList)) { + // 区域学历分布 + List degreeExpertDictionaryList = iExpertDictionaryService + .listByUserId(regionDegreeExpertIdList, DictExpertInfoTypeEnum.DEGREE); + Map> degreeCodeMap = degreeExpertDictionaryList.stream() + .map(ExpertDictionary::getDictionaryCode) + .collect(Collectors.groupingBy(Function.identity())); + AnalysisChart regionExpertEducationChartAnalysisChart = + dashboardChartAssembler.assemblerAnalysisChart(degreeCodeMap, ChartTypeEnum.REGION_EXPERT_EDUCATION_CHART); + analysisChartList.add(regionExpertEducationChartAnalysisChart); + + // 区域职称级别分布 + List titleLevelExpertDictionaryList = iExpertDictionaryService + .listByUserId(regionDegreeExpertIdList, DictExpertInfoTypeEnum.TITLE_LEVEL); + Map> titleLevelCodeMap = titleLevelExpertDictionaryList.stream() + .collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); + AnalysisChart regionExpertTitleLevelChartAnalysisChart = + dashboardChartAssembler.assemblerAnalysisChart(titleLevelCodeMap, ChartTypeEnum.REGION_EXPERT_TITLE_LEVEL_CHART); + analysisChartList.add(regionExpertTitleLevelChartAnalysisChart); + } + + // 评审次数 + List normalMeetingList = iMeetingService.list(Wrappers.lambdaQuery(Meeting.class) + .eq(StringUtils.isNotBlank(queryRegionCode), Meeting::getRegionCode, queryRegionCode) + .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode())); + Integer meetingCnt = normalMeetingList.size(); + + // 各类型评审次数 + Map> meetingTypeMap = normalMeetingList.stream().collect(Collectors.groupingBy(Meeting::getType)); + AnalysisChart meetingTypeCntChartAnalysisChart = + dashboardChartAssembler.assemblerAnalysisChart(meetingTypeMap, ChartTypeEnum.MEETING_TYPE_CNT_CHART); + analysisChartList.add(meetingTypeCntChartAnalysisChart); + + // 明星专家列表 + List starExpertList = new ArrayList<>(); + List meetingExpertJudgeList = iMeetingExpertJudgeService.list(); + Map> expertIdMeetingExpertJudgeMap = meetingExpertJudgeList.stream() + .collect(Collectors.groupingBy(MeetingExpertJudge::getExpertId)); + Map expertIdExpertNameMap = evidenceHasBeenSubmittedExpertInfoList.stream() + .collect(Collectors.toMap(ExpertUserFullInfo::getUserId, ExpertUserFullInfo::getExpertName)); + + for (Long expertId : expertIdMeetingExpertJudgeMap.keySet()) { + String expertName = expertIdExpertNameMap.get(expertId); + List expertMeetingExpertJudgeList = expertIdMeetingExpertJudgeMap.get(expertId); + DoubleSummaryStatistics statistics = expertMeetingExpertJudgeList + .stream().filter(r -> Objects.nonNull(r.getScore())) + .map(MeetingExpertJudge::getScore).mapToDouble(Number::doubleValue).summaryStatistics(); + double average = statistics.getAverage(); + StarExpertBO starExpertBO = new StarExpertBO(); + starExpertBO.setAveragePerformanceScore(average); + starExpertBO.setExpertId(expertId); + starExpertBO.setExpertName(expertName); + starExpertList.add(starExpertBO); + } + starExpertList = starExpertList.stream() + .sorted(Comparator.comparing(StarExpertBO::getAveragePerformanceScore) + .reversed()).collect(Collectors.toList()); + if (starExpertList.size() > 5) { + starExpertList = starExpertList.subList(0, 5); + } + + // 装配返回类 + ExpertDashboardSummaryVO expertDashboardSummaryVO = new ExpertDashboardSummaryVO(); + expertDashboardSummaryVO.setMeetingCnt(meetingCnt); + expertDashboardSummaryVO.setStarExpertList(starExpertList); + expertDashboardSummaryVO.setAnalysisChartList(analysisChartList); + return expertDashboardSummaryVO; + } + +} + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java new file mode 100644 index 0000000..663fac5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java @@ -0,0 +1,317 @@ +package com.ningdatech.pmapi.dashboard.manage; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; +import com.ningdatech.pmapi.dashboard.helper.DashboardChartAssembler; +import com.ningdatech.pmapi.dashboard.helper.DashboardHelper; +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; +import com.ningdatech.pmapi.dashboard.model.basic.CompanyProjectCntBO; +import com.ningdatech.pmapi.dashboard.model.basic.ProjectATIISBO; +import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO; +import com.ningdatech.pmapi.dashboard.model.vo.DashboardInvestmentSummaryVO; +import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectCntSummaryVO; +import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectSummaryVO; +import com.ningdatech.pmapi.projectdeclared.model.entity.Purchase; +import com.ningdatech.pmapi.projectdeclared.service.IPurchaseService; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectDelayApply; +import com.ningdatech.pmapi.projectlib.service.INdProjectDelayApplyService; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author liuxinxin + * @date 2023/8/2 上午10:39 + */ + +@Component +@RequiredArgsConstructor +public class DashboardProjectManage { + + private final IProjectService iProjectService; + private final INdProjectDelayApplyService iProjectDelayApplyService; + private final DashboardHelper dashboardHelper; + private final IPurchaseService iPurchaseService; + + public DashboardProjectSummaryVO getProjectSummary(QueryYearPO queryYearPO) { + // 预算年度 + Integer year = queryYearPO.getYear(); + String regionCode = queryYearPO.getRegionCode(); + List allProjectWithRepeatList = iProjectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Objects.nonNull(year), Project::getProjectYear, year) + .eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode) + ); + List allProjectList = allProjectWithRepeatList.stream() + .filter(r -> r.getNewest()).collect(Collectors.toList()); + + List allProjectIdWithRepeatList = allProjectWithRepeatList.stream().map(Project::getId).collect(Collectors.toList()); + + // 项目总数 + Integer projectCnt = allProjectList.size(); + + // 待立项项目数 + List toBeApprovedProjectList = allProjectList.stream() + .filter(r -> ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(r.getStatus())) + .collect(Collectors.toList()); + Integer toBeApprovedProjectCnt = toBeApprovedProjectList.size(); + + // 已立项项目数 + Integer approvedProjectCnt = projectCnt - toBeApprovedProjectCnt; + + // 项目立项率 + Double projectApprovalRate = new BigDecimal((float) approvedProjectCnt / projectCnt).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + + // 项目申报总金额 + List declareAmountList = allProjectList.stream().filter(r -> Objects.nonNull(r.getDeclareAmount())) + .map(Project::getDeclareAmount). + collect(Collectors.toList()); + BigDecimal declareAmountSum = new BigDecimal("0"); + for (BigDecimal declareAmount : declareAmountList) { + declareAmountSum.add(declareAmount); + } + + // 项目批复总金额 + List approvedTotalInvestmentIncreaseList = allProjectList.stream().filter(r -> Objects.nonNull(r.getApprovedTotalInvestmentIncrease())) + .map(Project::getApprovedTotalInvestmentIncrease) + .collect(Collectors.toList()); + BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0"); + for (BigDecimal approvedTotalInvestmentIncrease : approvedTotalInvestmentIncreaseList) { + approvedTotalInvestmentIncreaseSum.add(approvedTotalInvestmentIncrease); + } + + // 资金核定率 + BigDecimal fundApprovalRate = new BigDecimal("0"); + if (new BigDecimal("0").compareTo(approvedTotalInvestmentIncreaseSum) != 0) { + fundApprovalRate = declareAmountSum.divide(approvedTotalInvestmentIncreaseSum, 2, BigDecimal.ROUND_HALF_UP); + } + + + // 项目采购总金额 + BigDecimal projectProcurementTotalAmount = new BigDecimal("0"); + List purchaseList = iPurchaseService.list(Wrappers.lambdaQuery(Purchase.class) + .in(Purchase::getProjectId, allProjectIdWithRepeatList)); + for (Purchase purchase : purchaseList) { + BigDecimal transactionAmount = purchase.getTransactionAmount(); + if (Objects.nonNull(transactionAmount)) { + projectProcurementTotalAmount.add(transactionAmount); + } + } + +// 项目画像 + + // 延期项目数 延期占比 + List projectDelayApplyList = iProjectDelayApplyService + .list(Wrappers.lambdaQuery(ProjectDelayApply.class) + .in(ProjectDelayApply::getProjectId, allProjectIdWithRepeatList)); + Map> projectDelayApplyListMap = projectDelayApplyList.stream().collect(Collectors.groupingBy(ProjectDelayApply::getProjectId)); + Integer delayProjectCnt = projectDelayApplyListMap.keySet().size(); + Double delayProportion = new BigDecimal((float) delayProjectCnt / projectCnt).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + + // 项目变更数量 项目变更金额 + List changedProjectList = new ArrayList<>(); + Map> allProjectMap = allProjectWithRepeatList.stream().collect(Collectors.groupingBy(Project::getProjectCode)); + for (String projectCode : allProjectMap.keySet()) { + List projectList = allProjectMap.get(projectCode); + Project newestProject = projectList.stream() + .filter(r -> r.getNewest()) + .collect(Collectors.toList()).get(0); + Boolean isChanged = false; + for (Project project : projectList) { + Boolean newest = project.getNewest(); + Boolean isBackReject = project.getIsBackReject(); + if (!newest && isBackReject) { + isChanged = true; + break; + } + } + if (isChanged) { + changedProjectList.add(newestProject); + } + } + Integer changedProjectCnt = changedProjectList.size(); + + // 项目变更金额 + BigDecimal changedProjectContractAmountSum = new BigDecimal("0"); + for (Project project : changedProjectList) { + BigDecimal contractAmount = project.getContractAmount(); + if (Objects.nonNull(contractAmount)) { + changedProjectContractAmountSum.add(contractAmount); + } + } + + // 装配返回VO + DashboardProjectSummaryVO dashboardProjectSummaryVO = new DashboardProjectSummaryVO(); + dashboardProjectSummaryVO.setProjectCnt(projectCnt); + dashboardProjectSummaryVO.setApprovedProjectCnt(approvedProjectCnt); + dashboardProjectSummaryVO.setToBeApprovedProjectCnt(toBeApprovedProjectCnt); + dashboardProjectSummaryVO.setProjectApprovalRate(projectApprovalRate); + dashboardProjectSummaryVO.setDeclareAmountSum(declareAmountSum); + dashboardProjectSummaryVO.setApprovedTotalInvestmentIncreaseSum(approvedTotalInvestmentIncreaseSum); + + dashboardProjectSummaryVO.setDelayProjectCnt(delayProjectCnt); + dashboardProjectSummaryVO.setDelayProportion(delayProportion); + dashboardProjectSummaryVO.setChangedProjectCnt(changedProjectCnt); + dashboardProjectSummaryVO.setChangedProjectContractAmountSum(changedProjectContractAmountSum); + dashboardProjectSummaryVO.setFundApprovalRate(fundApprovalRate); + return dashboardProjectSummaryVO; + } + + public DashboardProjectCntSummaryVO getProjectCntSummary(QueryYearPO queryYearPO) { + // 预算年度 + Integer year = queryYearPO.getYear(); + String regionCode = queryYearPO.getRegionCode(); + List allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, true) + .eq(Objects.nonNull(year), Project::getProjectYear, year) + .eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode) + ); + + // 单位项目数量TOP5 + List companyProjectCntTop5List = new ArrayList<>(); + Map> buildOrgNameProjectGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getBuildOrgName)); + for (String buildOrgName : buildOrgNameProjectGroupMap.keySet()) { + List projectList = buildOrgNameProjectGroupMap.get(buildOrgName); + CompanyProjectCntBO companyProjectCntBO = new CompanyProjectCntBO(); + companyProjectCntBO.setBuildOrgName(buildOrgName); + companyProjectCntBO.setProjectCnt(projectList.size()); + companyProjectCntTop5List.add(companyProjectCntBO); + } + companyProjectCntTop5List = companyProjectCntTop5List.stream() + .sorted(Comparator.comparing(CompanyProjectCntBO::getProjectCnt).reversed()) + .collect(Collectors.toList()); + if (companyProjectCntTop5List.size() > 5) { + companyProjectCntTop5List = companyProjectCntTop5List.subList(0, 5); + } + + // 项目增补情况 + Map> isTemporaryAugmentGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getIsTemporaryAugment)); + Map temporaryAugmentMap = dashboardHelper.getTemporaryAugmentMap(); + AnalysisChart isTemporaryAugmentAnalysisChart = DashboardChartAssembler.buildAnalysisChart(temporaryAugmentMap, isTemporaryAugmentGroupMap + , ChartTypeEnum.PROJECT_SUPPLEMENTATION_STATUS_CHART); + + // 各类型项目数量 + Map> projectTypeGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getProjectType)); + Map projectTypeMap = dashboardHelper.getTemporaryAugmentMap(); + AnalysisChart projectTypeAnalysisChart = DashboardChartAssembler.buildAnalysisChart(projectTypeMap, projectTypeGroupMap + , ChartTypeEnum.EACH_TYPE_QUANTITY_OF_PROJECT_CHART); + + // 各区域项目数量 + Map> areaCodeGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getAreaCode)); + Map liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap(); + AnalysisChart areaCodeAnalysisChart = DashboardChartAssembler.buildAnalysisChart(liShuiRegionCodeNameMap, areaCodeGroupMap + , ChartTypeEnum.PROJECTS_NUMBER_IN_EACH_REGION_CHART); + + // 各领域项目数量 + Map> bizDomainGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getBizDomain)); + Map bizDomainMap = dashboardHelper.getBizDomainMap(); + AnalysisChart bizDomainAnalysisChart = DashboardChartAssembler.buildAnalysisChart(bizDomainMap, bizDomainGroupMap + , ChartTypeEnum.PROJECTS_NUMBER_IN_VARIOUS_FIELDS_CHART); + + // 各阶段项目数量 + Map> projectStateGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getStage)); + AnalysisChart projectStateAnalysisChart = DashboardChartAssembler + .buildProjectStateAnalysisChart(projectStateGroupMap, ChartTypeEnum.PROJECTS_NUMBER_IN_EACH_STAGE_CHART); + + DashboardProjectCntSummaryVO dashboardProjectCntSummaryVO = new DashboardProjectCntSummaryVO(); + dashboardProjectCntSummaryVO.setCompanyProjectCntTop5List(companyProjectCntTop5List); + List analysisChartList = new ArrayList<>(); + dashboardProjectCntSummaryVO.setAnalysisChartList(analysisChartList); + analysisChartList.add(isTemporaryAugmentAnalysisChart); + analysisChartList.add(projectTypeAnalysisChart); + analysisChartList.add(bizDomainAnalysisChart); + analysisChartList.add(areaCodeAnalysisChart); + analysisChartList.add(projectStateAnalysisChart); + return dashboardProjectCntSummaryVO; + } + + + public DashboardInvestmentSummaryVO getInvestmentSummary(QueryYearPO queryYearPO) { + // 预算年度 + Integer year = queryYearPO.getYear(); + String regionCode = queryYearPO.getRegionCode(); + List allProjectList = iProjectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getNewest, true) + .eq(Objects.nonNull(year), Project::getProjectYear, year) + .eq(StringUtils.isNotBlank(regionCode), Project::getAreaCode, regionCode) + ); + + // 项目预算TOP5 + List projectATIISTop5List = allProjectList.stream().filter(r -> Objects.nonNull(r.getApprovedTotalInvestmentIncrease())) + .map(r -> { + ProjectATIISBO projectATIISBO = new ProjectATIISBO(); + projectATIISBO.setProjectId(r.getId()); + projectATIISBO.setProjectCode(r.getProjectCode()); + projectATIISBO.setProjectName(r.getProjectName()); + projectATIISBO.setApprovedTotalInvestmentIncrease(r.getApprovedTotalInvestmentIncrease()); + return projectATIISBO; + }).collect(Collectors.toList()); + projectATIISTop5List = projectATIISTop5List.stream() + .sorted(Comparator.comparing(ProjectATIISBO::getApprovedTotalInvestmentIncrease) + .reversed()).collect(Collectors.toList()); + if (projectATIISTop5List.size() > 5) { + projectATIISTop5List = projectATIISTop5List.subList(0, 5); + } + + // 单位预算TOP5 + List companyProjectATIISTop5List = new ArrayList<>(); + Map> buildOrgNameProjectGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getBuildOrgName)); + for (String buildOrgName : buildOrgNameProjectGroupMap.keySet()) { + List projectList = buildOrgNameProjectGroupMap.get(buildOrgName); + CompanyProjectCntBO companyProjectCntBO = new CompanyProjectCntBO(); + companyProjectCntBO.setBuildOrgName(buildOrgName); + BigDecimal approvedTotalInvestmentIncreaseSum = new BigDecimal("0"); + for (Project project : projectList) { + BigDecimal approvedTotalInvestmentIncrease = project.getApprovedTotalInvestmentIncrease(); + if (Objects.nonNull(approvedTotalInvestmentIncrease)) { + approvedTotalInvestmentIncreaseSum.add(approvedTotalInvestmentIncrease); + } + } + companyProjectCntBO.setApprovedTotalInvestmentIncreaseSum(approvedTotalInvestmentIncreaseSum); + companyProjectATIISTop5List.add(companyProjectCntBO); + } + companyProjectATIISTop5List = companyProjectATIISTop5List.stream() + .sorted(Comparator.comparing(CompanyProjectCntBO::getApprovedTotalInvestmentIncreaseSum).reversed()) + .collect(Collectors.toList()); + if (companyProjectATIISTop5List.size() > 5) { + companyProjectATIISTop5List = companyProjectATIISTop5List.subList(0, 5); + } + + // 各领域项目投资情况 + Map> bizDomainGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getBizDomain)); + Map bizDomainMap = dashboardHelper.getBizDomainMap(); + AnalysisChart bizDomainInvestmentAnalysisChart = DashboardChartAssembler.buildInvestmentAnalysisChart(bizDomainMap, bizDomainGroupMap + , ChartTypeEnum.PROJECTS_INVESTMENT_AMOUNT_IN_VARIOUS_FIELDS_CHART); + + // 各区域项目投资情况 + Map> areaCodeGroupMap = allProjectList.stream() + .collect(Collectors.groupingBy(Project::getAreaCode)); + Map liShuiRegionCodeNameMap = dashboardHelper.getLiShuiRegionCodeNameMap(); + AnalysisChart areaCodeInvestmentAnalysisChart = DashboardChartAssembler.buildInvestmentAnalysisChart(liShuiRegionCodeNameMap, areaCodeGroupMap + , ChartTypeEnum.PROJECTS_INVESTMENT_SITUATION_IN_VARIOUS_REGIONS); + + DashboardInvestmentSummaryVO dashboardInvestmentSummaryVO = new DashboardInvestmentSummaryVO(); + dashboardInvestmentSummaryVO.setCompanyProjectATIISTop5List(companyProjectATIISTop5List); + dashboardInvestmentSummaryVO.setProjectATIISTop5List(projectATIISTop5List); + List analysisChartList = new ArrayList<>(); + dashboardInvestmentSummaryVO.setAnalysisChartList(analysisChartList); + analysisChartList.add(areaCodeInvestmentAnalysisChart); + analysisChartList.add(bizDomainInvestmentAnalysisChart); + return dashboardInvestmentSummaryVO; + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisChart.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisChart.java new file mode 100644 index 0000000..7091913 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisChart.java @@ -0,0 +1,25 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import com.ningdatech.pmapi.dashboard.constant.ChartTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/8/2 下午3:02 + */ + +@Data +@ApiModel("图表数据") +public class AnalysisChart { + + @ApiModelProperty("图表数据类型") + private ChartTypeEnum chartType; + + @ApiModelProperty("数据列表") + private List dataList; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisData.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisData.java new file mode 100644 index 0000000..448e15d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/AnalysisData.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/8/2 下午2:27 + */ + +@Data +@ApiModel("分析数据基础类") +public class AnalysisData { + + @ApiModelProperty("key") + private String key; + + @ApiModelProperty("值") + private Object value; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/CompanyProjectCntBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/CompanyProjectCntBO.java new file mode 100644 index 0000000..ea92abe --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/CompanyProjectCntBO.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import com.ningdatech.pmapi.common.compare.Compare; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author liuxinxin + * @date 2023/8/4 下午3:51 + */ + +@Data +@ApiModel("单位项目数量") +public class CompanyProjectCntBO { + + @ApiModelProperty("建设单位名称") + private String buildOrgName; + + @Compare("建设单位统一社会信用代码") + private String orgCreditCode; + + @ApiModelProperty("项目数量") + private Integer projectCnt; + + @ApiModelProperty("项目预算(批复金额总合)") + private BigDecimal approvedTotalInvestmentIncreaseSum; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/ProjectATIISBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/ProjectATIISBO.java new file mode 100644 index 0000000..b334aaf --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/ProjectATIISBO.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import com.ningdatech.pmapi.common.compare.Compare; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author liuxinxin + * @date 2023/8/4 下午4:12 + */ + +@Data +@ApiModel("项目预算") +public class ProjectATIISBO { + + @ApiModelProperty("项目id") + private Long projectId; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("批复金额") + @Compare("批复金额") + private BigDecimal approvedTotalInvestmentIncrease; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java new file mode 100644 index 0000000..beca0f2 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/QueryTimeYearBO.java @@ -0,0 +1,23 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2023/7/27 下午3:24 + */ + +@Data +@ApiModel("查询年份起止BO") +public class QueryTimeYearBO { + + @ApiModelProperty("开始年份时间") + private LocalDateTime startYearTime; + + @ApiModelProperty("截止年份时间") + private LocalDateTime endYearTime; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/StarExpertBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/StarExpertBO.java new file mode 100644 index 0000000..b3e354a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/StarExpertBO.java @@ -0,0 +1,24 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/8/2 下午3:57 + */ + +@Data +@ApiModel("明星专家") +public class StarExpertBO { + + @ApiModelProperty("专家姓名") + private String expertName; + + @ApiModelProperty("专家id") + private Long expertId; + + @ApiModelProperty("履职平均分") + private Double averagePerformanceScore; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/YearTrendBO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/YearTrendBO.java new file mode 100644 index 0000000..a3a327b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/basic/YearTrendBO.java @@ -0,0 +1,45 @@ +package com.ningdatech.pmapi.dashboard.model.basic; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/8/4 下午4:27 + */ + +@Data +@ApiModel("年度走势BO") +public class YearTrendBO { + + @ApiModelProperty("年份") + private Integer year; + + @ApiModelProperty("项目总数") + private Integer projectCnt; + + /** + * 建设类项目总数 + */ + + /** + * 运维类项目总数 + */ + + /** + * 建设类项目批复金额 + */ + + /** + * 运维类项目批复金额 + */ + + /** + * 资金核定率 + */ + + /** + * 立项率 + */ +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/po/QueryYearPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/po/QueryYearPO.java new file mode 100644 index 0000000..6f0dae6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/po/QueryYearPO.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.dashboard.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/8/2 下午3:51 + */ + +@Data +@ApiModel("查询年份") +public class QueryYearPO { + + @ApiModelProperty("查询年份") + private Integer year; + + @ApiModelProperty("区域编码") + private String regionCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardInvestmentSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardInvestmentSummaryVO.java new file mode 100644 index 0000000..7405847 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardInvestmentSummaryVO.java @@ -0,0 +1,34 @@ +package com.ningdatech.pmapi.dashboard.model.vo; + +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; +import com.ningdatech.pmapi.dashboard.model.basic.CompanyProjectCntBO; +import com.ningdatech.pmapi.dashboard.model.basic.ProjectATIISBO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/8/2 下午3:36 + */ + +@Data +@ApiModel("驾驶舱投资金额统计数据") +public class DashboardInvestmentSummaryVO { + + /** + * 近5年项目投资走势 + * 近5年资金核定率走势 + */ + + @ApiModelProperty("项目预算TOP5") + private List projectATIISTop5List; + + @ApiModelProperty("单位预算TOP5") + private List companyProjectATIISTop5List; + + @ApiModelProperty("各领域项目投资金额,各区域项目投资情况") + private List analysisChartList; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java new file mode 100644 index 0000000..9f7b312 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectCntSummaryVO.java @@ -0,0 +1,30 @@ +package com.ningdatech.pmapi.dashboard.model.vo; + +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; +import com.ningdatech.pmapi.dashboard.model.basic.CompanyProjectCntBO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/8/2 下午3:36 + */ + +@Data +@ApiModel("项目数量驶舱统计数据") +public class DashboardProjectCntSummaryVO { + /** + * 近5年项目数量走势 + * 近5年立项率走势 + */ + + @ApiModelProperty("单位项目数量TOP5") + private List companyProjectCntTop5List; + + @ApiModelProperty("项目增补情况,各类型项目数量,各区域项目数量,各领域项目数量,各阶段项目数量") + private List analysisChartList; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java new file mode 100644 index 0000000..166dd82 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/DashboardProjectSummaryVO.java @@ -0,0 +1,58 @@ +package com.ningdatech.pmapi.dashboard.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author liuxinxin + * @date 2023/8/2 下午3:37 + */ +@Data +@ApiModel("驾驶舱项目总览驶舱统计数据") +public class DashboardProjectSummaryVO { + /** + * 项目画像 + */ + + @ApiModelProperty("项目总数") + private Integer projectCnt; + + @ApiModelProperty("待立项项目数") + private Integer toBeApprovedProjectCnt; + + @ApiModelProperty("已立项项目数") + private Integer approvedProjectCnt; + + @ApiModelProperty("项目立项率") + private Double projectApprovalRate; + + @ApiModelProperty("项目申报总金额") + private BigDecimal declareAmountSum; + + @ApiModelProperty("项目批复总金额") + private BigDecimal approvedTotalInvestmentIncreaseSum; + + @ApiModelProperty("延期项目数") + private Integer delayProjectCnt; + + @ApiModelProperty("延期占比") + private Double delayProportion; + + @ApiModelProperty("项目变更数量") + private Integer changedProjectCnt; + + @ApiModelProperty("项目变更金额") + private BigDecimal changedProjectContractAmountSum; + + @ApiModelProperty("项目采购总金额") + private BigDecimal projectProcurementTotalAmount; + + // 批复总金额/申报总金额 + @ApiModelProperty("资金核定率") + private BigDecimal fundApprovalRate; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ExpertDashboardSummaryVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ExpertDashboardSummaryVO.java new file mode 100644 index 0000000..bf56914 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/dashboard/model/vo/ExpertDashboardSummaryVO.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.dashboard.model.vo; + +import com.ningdatech.pmapi.dashboard.model.basic.AnalysisChart; +import com.ningdatech.pmapi.dashboard.model.basic.StarExpertBO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liuxinxin + * @date 2023/8/2 下午3:07 + */ + +@Data +@ApiModel("专家驾驶舱统计数据") +public class ExpertDashboardSummaryVO { + + @ApiModelProperty("明星专家列表") + private List starExpertList; + + @ApiModelProperty("评审次数") + private Integer meetingCnt; + + @ApiModelProperty("图表列表 各区域专家总数,学历分布,职称级别分布,各类型评审次数") + List analysisChartList; + + +} + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java index 177a979..f5d3233 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java @@ -51,7 +51,7 @@ public class DingInfoPullController { private final ProcDefManage procDefManage; - @Resource(name = "refreshToken") + @Resource private IRefreshTokenService refreshTokenService; @Value("${irs.interface-refresh.request-token-url}") @@ -255,6 +255,12 @@ public class DingInfoPullController { return "推送失败"; } + @ApiOperation(value = "同步企业信息 条线", notes = "同步企业信息 条线") + @GetMapping("/synchronouOrgBiz") + public String synchronouOrgBiz() { + return procDefManage.synchronouOrgBiz(); + } + public static Workbook readExcel(InputStream is, String extString){ Workbook wb = null; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/OrganizationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/OrganizationController.java new file mode 100644 index 0000000..0f40b6f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/OrganizationController.java @@ -0,0 +1,42 @@ +package com.ningdatech.pmapi.irs.controller; + +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; +import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; +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 OrganizationController + * @Description + * @Date 2023/8/16 9:57 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/irs/org") +@Api(value = "Organization", tags = "irs-企业信息") +@RequiredArgsConstructor +public class OrganizationController { + + private final ZwddClient zwddClient; + + @ApiOperation(value = "获取企业信息", notes = "获取企业信息") + @GetMapping("/getOrganizationByCode/{code}") + public DingOrgInfoDTO getOrganizationByCode(@PathVariable String code) { + return zwddClient.getOrganizationByCode(code).getData(); + } + + @ApiOperation(value = "获取条线列表", notes = "获取条线列表") + @GetMapping("/getGovBusinessStripLine/{code}") + public List getGovBusinessStripLine(@PathVariable String code) { + return zwddClient.getGovBusinessStripLine(code).getData(); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java index 6120d4c..89386af 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java @@ -73,7 +73,7 @@ public class AppIrsManage { @Value("${irs.search-app.url}") private String searchUrl; - @Resource(name = "refreshToken") + @Resource private IRefreshTokenService refreshTokenService; @Value("${irs.interface-refresh.request-token-url}") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java new file mode 100644 index 0000000..43e3f3d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java @@ -0,0 +1,90 @@ +package com.ningdatech.pmapi.irs.manage; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ningdatech.irs.service.IRefreshTokenService; +import com.ningdatech.pmapi.common.util.CryptUtils; +import com.ningdatech.pmapi.common.util.HttpUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; +import javax.annotation.Resource; +import java.security.NoSuchAlgorithmException; +import java.util.Objects; + +/** + * @Classname ProjectIrsManage + * @Description + * @Date 2023/8/15 11:43 + * @Author PoffyZhang + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class ProjectIrsManage { + + @Value("${irs.core-biz.appKey}") + private String appKey; + + @Value("${irs.core-biz.appSecret}") + private String appSecret; + + @Value("${irs.core-biz.url}") + private String coreBizUrl; + + @Value("${irs.core-biz.interfaceName}") + private String interfaceName; + @Resource + private IRefreshTokenService refreshTokenService; + + @Value("${irs.interface-refresh.request-token-url}") + private String govRequestTokenUrl; + @Value("${irs.interface-refresh.refresh-token-url}") + private String govRefreshTokenUrl; + + /** + * 查询核心业务 + * + * @param businessName + * @return + * @throws NoSuchAlgorithmException + */ + public JSONObject searchCoreBiz(String businessName,String orgCode,Integer limit,Integer page) { + long timestamp = System.currentTimeMillis(); + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, + interfaceName, HttpMethod.POST.name()); + String sign = null; + try{ + sign = CryptUtils.MD5Encode(appKey + secret + timestamp); + }catch (Exception e){ + log.error(e.getMessage()); + } + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + + String url = coreBizUrl + "?" + + "dingCode=" + orgCode + "&matterName=" + (StringUtils.isNotBlank(businessName)?businessName:StringUtils.EMPTY) + "&oid=&useState=1&" + + "limit=" + (Objects.isNull(limit) ? "10" : limit) + "&page=" + (Objects.isNull(page) ? "1" : page) + + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; + + ResponseEntity forEntity = restTemplate.getForEntity(url, JSONObject.class); + JSONObject body = forEntity.getBody(); + log.info("body :{}",body); + JSONObject datas = body.getJSONObject("datas"); + if(Objects.nonNull(datas)){ + return datas; + } + return forEntity.getBody(); + } +} 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/meeting/controller/DashboardController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/ExpertDashboardController.java similarity index 98% rename from pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/DashboardController.java rename to pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/ExpertDashboardController.java index 412ef49..2578f8e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/DashboardController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/ExpertDashboardController.java @@ -28,7 +28,7 @@ import java.util.List; @RestController @AllArgsConstructor @RequestMapping("/api/v1/dashboard") -public class DashboardController { +public class ExpertDashboardController { private final DashboardManage dashboardManage; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java index 60acd33..6d5ca27 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/ProcDefManage.java @@ -4,11 +4,14 @@ import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; +import com.ningdatech.basic.model.GenericResult; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.organization.constants.ProcDefContant; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; import com.wflow.bean.entity.WflowOrgModelHistorys; import com.wflow.bean.entity.WflowOrgModels; import com.wflow.enums.ProcessDefTypeEnum; @@ -16,6 +19,7 @@ import com.wflow.service.OrgProcdefHistoryService; import com.wflow.service.OrgProcdefService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import java.time.LocalDateTime; @@ -38,6 +42,8 @@ public class ProcDefManage { private final OrgProcdefHistoryService orgProcdefHistoryService; + private final ZwddClient zwddClient; + /** * 初始化 单位配置 * @return @@ -140,4 +146,21 @@ public class ProcDefManage { return "初始化成功"; } + + public String synchronouOrgBiz() { + List orgs = organizationService.list(); + //同步所有的 企业条线 + for(DingOrganization org : orgs){ + GenericResult organization = zwddClient.getOrganizationByCode(org.getOrganizationCode()); + if(organization.isSuccess()){ + DingOrgInfoDTO data = organization.getData(); + String businessStripCodes = data.getBusinessStripCodes(); + if(StringUtils.isNotBlank(businessStripCodes)){ + org.setBusinessStripCodes(businessStripCodes); + organizationService.updateById(org); + } + } + } + return "更新完成"; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/constant/BizConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/constant/BizConst.java new file mode 100644 index 0000000..c59b17d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/constant/BizConst.java @@ -0,0 +1,38 @@ +package com.ningdatech.pmapi.performance.constant; + +/** + * 常量 + * @return + * @author CMM + * @since 2023/08/08 17:53 + */ +public interface BizConst { + + /** + * 500万元 + */ + Integer FIVE_MILLION = 500; + /** + * 2000万元 + */ + Integer TWENTY_MILLION = 2000; + + /** + * 立项批复金额在500万以下 + */ + Integer AMOUNT_RANGE_ONE = 1; + + /** + * 立项批复金额在500万-2000万之间 + */ + Integer AMOUNT_RANGE_TWO = 2; + + /** + * 立项批复金额大于2000万 + */ + Integer AMOUNT_RANGE_THREE = 3; + /** + * 复评员 + */ + String REAPPRAISAL_ROLE = "复评员"; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java index d9c16d0..9b10fc7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/OrgSelfAppraisalController.java @@ -2,14 +2,18 @@ package com.ningdatech.pmapi.performance.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.performance.manage.OrgSelfAppraisalManage; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; +import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; + /** * @Classname OrgSelfAppraisalController * @Description @@ -39,6 +43,19 @@ public class OrgSelfAppraisalController { @GetMapping("/appraisaled-list/{planId}") @ApiOperation("当前绩效评价已自评列表") public PageVo appraisaledList(@PathVariable Long planId,PerformanceAppraisalListReq req) { - return selfAppraisalManage.appraisaledList(planId); + return selfAppraisalManage.appraisaledList(planId,req); + } + + @GetMapping("/get-appraisal-template-detail/{projectCode}") + @ApiOperation("获取自评模版详情") + public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(@PathVariable String projectCode){ + return selfAppraisalManage.getAppraisalTemplateDetail(projectCode); } + + @PostMapping("/submit-self-appraisal") + @ApiOperation("提交自评") + public String submitSelfAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ + return selfAppraisalManage.submitSelfAppraisal(param); + } + } 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/controller/ReAppraisalController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/ReAppraisalController.java new file mode 100644 index 0000000..dd9e956 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/ReAppraisalController.java @@ -0,0 +1,51 @@ +package com.ningdatech.pmapi.performance.controller; + +import javax.validation.Valid; + +import com.ningdatech.pmapi.performance.manage.ReAppraisalManage; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; +import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; + +/** + * ReAppraisalController + * @return + * @author CMM + * @since 2023/08/10 8:54 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-人工复评") +@RequestMapping("/api/v1/re-appraisal") +public class ReAppraisalController { + + private final ReAppraisalManage reAppraisalManage; + + @GetMapping("/list") + @ApiOperation("当前复评用户的绩效评价计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return reAppraisalManage.list(req); + } + + @GetMapping("/group-project-list/{groupId}") + @ApiOperation("当前复评用户所在分组复评项目列表") + public PageVo groupProjectList(@PathVariable Long groupId, PerformanceAppraisalListReq req) { + return reAppraisalManage.groupProjectList(groupId,req); + } + + @PostMapping("/submit-reAppraisal") + @ApiOperation("提交复评") + public String submitReAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){ + return reAppraisalManage.submitReAppraisal(param); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/VerifyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/VerifyController.java new file mode 100644 index 0000000..b68015e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/controller/VerifyController.java @@ -0,0 +1,50 @@ +package com.ningdatech.pmapi.performance.controller; + +import javax.validation.Valid; + +import com.ningdatech.pmapi.performance.manage.VerifyManage; +import org.springframework.web.bind.annotation.*; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +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; +import lombok.RequiredArgsConstructor; + +/** + * VerifyController + * @return + * @author CMM + * @since 2023/08/10 8:54 + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "绩效评价-专家核查") +@RequestMapping("/api/v1/verify") +public class VerifyController { + + private final VerifyManage verifyManage; + + @GetMapping("/list") + @ApiOperation("当前核查用户的绩效评价计划列表") + public PageVo list(PerformanceAppraisalListReq req) { + return verifyManage.list(req); + } + + @GetMapping("/group-project-list/{groupId}") + @ApiOperation("当前核查用户所在分组核查项目列表") + public PageVo groupProjectList(@PathVariable Long groupId, PerformanceAppraisalListReq req) { + return verifyManage.groupProjectList(groupId,req); + } + + @PostMapping("/submit-verify") + @ApiOperation("提交核查") + public String submitVerify(@Valid @RequestBody ProjectAppraisalDTO param){ + return verifyManage.submitVerify(param); + } + +} 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..c2bf13d 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,7 +33,8 @@ public class PerformanceAppraisalConveter { return projects.stream().map(p -> { PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); vo.setIsReAppraisal(p.getIsReAppraisal()); - vo.setId(p.getProjectId()); + vo.setCanSelfAppraisal(checkCanSelfAppraisal(p)); + vo.setProjectId(p.getProjectId()); if(map.containsKey(p.getProjectCode())){ Project project = map.get(p.getProjectCode()); vo.setProjectCode(project.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/AppraisalTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.java new file mode 100644 index 0000000..0dd22b3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/enumration/AppraisalTypeEnum.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; + +/** + * AppraisalTypeEnum + * @return + * @author CMM + * @since 2023/07/26 16:44 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum AppraisalTypeEnum { + /** + * 评价类型 + */ + SELF_APPRAISAL(1, "单位自评"), + RE_APPRAISAL(2, "人工复评"), + EXPERT_VERIFY(3, "专家核查"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (AppraisalTypeEnum t : AppraisalTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} 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/helper/TemplateDetailBuildHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java new file mode 100644 index 0000000..2c866a1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/TemplateDetailBuildHelper.java @@ -0,0 +1,22 @@ +package com.ningdatech.pmapi.performance.helper; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; +import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO; +import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO; + +import java.util.List; + +/** + * 模板详情构建helper + * @return + * @author CMM + * @since 2023/08/09 22:28 + */ +public interface TemplateDetailBuildHelper { + /** + * 构建评价模板详情信息 + * @param templateDetails + * @return + */ + List buildTemplateDetail(List templateDetails, ProjectAppraisalIndexDetailVO vo); +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java new file mode 100644 index 0000000..5cfef4d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/helper/impl/TemplateDetailBuildHelperImpl.java @@ -0,0 +1,130 @@ +package com.ningdatech.pmapi.performance.helper.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; +import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; +import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; +import com.ningdatech.pmapi.performance.model.entity.PerformanceIndicatorProjectTemplateDetail; +import com.ningdatech.pmapi.performance.model.vo.ProjectAppraisalIndexDetailVO; +import com.ningdatech.pmapi.performance.model.vo.ProjectTemplateDetailVO; +import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalScoreInfoService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author CMM + * @since 2023/08/09 22:31 + */ +@Component +@RequiredArgsConstructor +public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper { + + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + + @Override + public List buildTemplateDetail(List templateDetails, ProjectAppraisalIndexDetailVO vo) { + List res = Lists.newArrayList(); + //第一层是 一级的 + for (PerformanceIndicatorProjectTemplateDetail templateDetailFirst : templateDetails) { + if (PerformanceTemplateTypeEnum.FIRST_INDEX.getCode().equals(templateDetailFirst.getType())) { + ProjectTemplateDetailVO detailFirstVo = BeanUtil.copyProperties(templateDetailFirst, ProjectTemplateDetailVO.class); + List firstList = Lists.newArrayList(); + // 该层循环筛选出第二 指标 + for (PerformanceIndicatorProjectTemplateDetail templateDetailSecond : templateDetails) { + if (Objects.nonNull(templateDetailSecond.getParentId()) && + templateDetailSecond.getParentId().equals(templateDetailFirst.getId())) { + ProjectTemplateDetailVO detailSecondVo = BeanUtil.copyProperties(templateDetailSecond, ProjectTemplateDetailVO.class); + List secondList = Lists.newArrayList(); + // 该层循环筛选出第三 指标 + for (PerformanceIndicatorProjectTemplateDetail templateDetailThird : templateDetails) { + if (Objects.nonNull(templateDetailThird.getParentId()) && + templateDetailThird.getParentId().equals(templateDetailSecond.getId())) { + ProjectTemplateDetailVO detailThirdVo = BeanUtil.copyProperties(templateDetailThird, ProjectTemplateDetailVO.class); + // 如果有单位自评、复评、核查分数信息,各自装配信息 + // 获取自评分数信息 + List selfAppraisalScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode())); + if (CollUtil.isNotEmpty(selfAppraisalScoreInfo)) { + detailThirdVo.setSelfAppraisalScoreInfo(selfAppraisalScoreInfo); + BigDecimal score = selfAppraisalScoreInfo.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + if (Objects.nonNull(vo)) { + vo.setSelfAppraisalTotalScore(score); + } + } + // 按照复评人员分组 获取复评分数信息 + List reAppraisalScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())); + if (CollUtil.isNotEmpty(reAppraisalScoreInfo)) { + Map> reAppScoreInfoMap = reAppraisalScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName)); + HashMap scoreMap = MapUtil.newHashMap(); + for (String name : reAppScoreInfoMap.keySet()) { + List scoreInfos = reAppScoreInfoMap.get(name); + BigDecimal totalScore = scoreInfos.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + scoreMap.put(name, totalScore); + } + detailThirdVo.setReAppraisalTotalScoreInfo(scoreMap); + detailThirdVo.setReAppraisalScoreInfo(reAppScoreInfoMap); + if (Objects.nonNull(vo)){ + BigDecimal sum = scoreMap.values().stream() + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + vo.setVerifyTotalScore(sum); + } + } + // 按照核查人员分组 获取核查分数信息 + List verifyScoreInfo = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getTemplateDetailId, templateDetailThird.getId()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())); + if (CollUtil.isNotEmpty(verifyScoreInfo)) { + Map> verifyScoreInfoMap = verifyScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName)); + HashMap scoreMap = MapUtil.newHashMap(); + for (String name : verifyScoreInfoMap.keySet()) { + List scoreInfos = verifyScoreInfoMap.get(name); + BigDecimal totalScore = scoreInfos.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + scoreMap.put(name, totalScore); + } + detailThirdVo.setVerifyTotalScoreInfo(scoreMap); + detailThirdVo.setVerifyScoreInfo(verifyScoreInfoMap); + if (Objects.nonNull(vo)){ + BigDecimal sum = scoreMap.values().stream() + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + vo.setVerifyTotalScore(sum); + } + } + secondList.add(detailThirdVo); + } + } + detailSecondVo.setChildren(secondList); + firstList.add(detailSecondVo); + } + } + detailFirstVo.setChildren(firstList); + res.add(detailFirstVo); + + } + } + return res; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java index bec49ae..9dbbe38 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/IndicatorConfigManage.java @@ -9,10 +9,12 @@ import com.google.common.collect.Lists; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.performance.enumration.PerformanceTemplateTypeEnum; +import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper; import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectIndexSaveDTO; import com.ningdatech.pmapi.performance.model.dto.PerformanceIndicatorProjectTemplateSaveDTO; @@ -42,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -60,6 +63,7 @@ public class IndicatorConfigManage { private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; private final IPerformanceAppraisalProjectIndicatorService projectIndicatorService; private final IPerformanceAppraisalAppIndicatorService appIndicatorService; + private final TemplateDetailBuildHelper templateDetailBuildHelper; /** * 模板列表 @@ -97,19 +101,27 @@ public class IndicatorConfigManage { } ProjectIndexTemplateVO vo = BeanUtil.copyProperties(template, ProjectIndexTemplateVO.class); + String projectTagIds = template.getProjectTagIds(); + if (StringUtils.isNotBlank(projectTagIds)){ + List proTagIdList = Arrays.stream(projectTagIds.split(StrPool.COMMA)).map(Long::valueOf).collect(Collectors.toList()); + vo.setProjectTagIds(proTagIdList); + } // 获取模版绩效指标详情 List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id)); + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); // 获取模版附加绩效指标详情 List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, id) .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); if(CollUtil.isNotEmpty(templateDetails)){ - vo.setTemplateDetails(buildTemplateDetail(templateDetails)); + List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,null); + vo.setTemplateDetails(templateDetailVos); } if (CollUtil.isNotEmpty(additionalTemplateDetails)){ - vo.setAdditionalIndexDetails(buildTemplateDetail(additionalTemplateDetails)); + List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,null); + vo.setAdditionalIndexDetails(additionalTemplateDetailVos); } return vo; } @@ -123,6 +135,13 @@ public class IndicatorConfigManage { public String projectTemplateSave(PerformanceIndicatorProjectTemplateSaveDTO dto) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); PerformanceIndicatorProjectTemplate template = BeanUtil.copyProperties(dto, PerformanceIndicatorProjectTemplate.class); + List projectTagIds = dto.getProjectTagIds(); + List tagIdList = projectTagIds.stream().map(String::valueOf).collect(Collectors.toList()); + template.setProjectTagIds(String.join(StrPool.COMMA, tagIdList)); + if (Objects.isNull(dto.getStatus())){ + // 默认模版禁用 + template.setStatus(0); + } if(Objects.nonNull(dto.getId())){ PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); @@ -139,10 +158,13 @@ public class IndicatorConfigManage { if(CollUtil.isNotEmpty(dto.getTemplateDetails())){ //先删除 indicatorProjectTemplateDetailService.remove(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) - .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId())); + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId,dto.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); + analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); //校检 所有3级指标(不包括附加指标) 总分是不是100 List indexList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, template.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE) .eq(PerformanceIndicatorProjectTemplateDetail::getType,PerformanceTemplateTypeEnum.THIRD_INDEX.getCode())); if(CollUtil.isNotEmpty(indexList)){ BigDecimal sum = indexList.stream() @@ -152,7 +174,6 @@ public class IndicatorConfigManage { boolean score = (BigDecimal.valueOf(100)).equals(sum); VUtils.isTrue(Boolean.FALSE.equals(score)).throwMessage("总分不是100 操作失败!"); } - analysisTemplateDetails(dto.getTemplateDetails(),template.getId()); } // 保存 模版附加指标详情 if (CollUtil.isNotEmpty(dto.getAdditionalIndexDetails())){ @@ -208,6 +229,7 @@ public class IndicatorConfigManage { templateDetail.setTemplateId(templateId); // 一级指标的父ID为null templateDetail.setParentId(parentId); + templateDetail.setIsAdditional(Boolean.FALSE); indicatorProjectTemplateDetailService.save(templateDetail); @@ -316,6 +338,17 @@ public class IndicatorConfigManage { public Boolean enOrDisProjectIndexTemplate(Long templateId, boolean active) { PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getById(templateId); if (Boolean.TRUE.equals(active)){ + // 根据创建模板时选择的项目类型、预算年度、项目金额、项目标签 + // 判断模板是否可以启用(同一套组合只能启用一套模板) + PerformanceIndicatorProjectTemplate template = indicatorProjectTemplateService.getOne(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) + .eq(PerformanceIndicatorProjectTemplate::getProjectType, projectTemplate.getProjectType()) + .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectTemplate.getProjectYear()) + .eq(PerformanceIndicatorProjectTemplate::getAmountRange, projectTemplate.getAmountRange()) + .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTemplate.getProjectTagIds()) + .eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode())); + if (Objects.nonNull(template)){ + throw new BizException("相同配置的模板已存在,当前模板无法启用!"); + } projectTemplate.setStatus(CommonEnum.YES.getCode()); }else { projectTemplate.setStatus(CommonEnum.NO.getCode()); 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..b0bcb24 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,26 +5,38 @@ 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; -import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalProject; +import com.ningdatech.basic.util.StrPool; +import com.ningdatech.pmapi.performance.constant.BizConst; +import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; +import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; +import com.ningdatech.pmapi.performance.model.entity.*; import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; -import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; -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.performance.model.vo.*; +import com.ningdatech.pmapi.performance.service.*; +import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; +import com.ningdatech.pmapi.portrait.service.IProjectTagService; +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; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -41,15 +53,14 @@ import java.util.stream.Collectors; public class OrgSelfAppraisalManage { private final IPerformanceAppraisalService performanceAppraisalService; - private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; - - private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; - private final IProjectService projectService; - - private final IProjectApplicationService applicationService; - + private final IRoleService roleService; + private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; + private final TemplateDetailBuildHelper templateDetailBuildHelper; + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + private final IProjectTagService projectTagService; + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; /** * 绩效列表 * @param req @@ -60,36 +71,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 +121,23 @@ 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())); + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() + .filter(p -> Objects.isNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); + 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 +150,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()); + BeanUtil.copyProperties(appraisalProject,vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); + vo.setAppraisalId(planId); return vo; }) .collect(Collectors.toList()); @@ -132,24 +165,205 @@ public class OrgSelfAppraisalManage { /** * 已经自评表 + * * @param planId + * @param req * @return */ - public PageVo appraisaledList(Long planId) { + public PageVo appraisaledList(Long planId, PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + + PerformanceAppraisal plan = performanceAppraisalService.getById(planId); + VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); + + // 获取评价计划内已添加的已评价项目信息 + List paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() + .filter(p -> Objects.nonNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); + Map papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); + + if(CollUtil.isEmpty(paps)){ + return PageVo.empty(); + } - return PageVo.empty(); + // 获取本单位在当前评价计划内的项目 + Set projectCodes = paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, projectCodes) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) + .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); + projectService.page(page,wrapper); + + if(0L == page.getTotal()){ + return PageVo.empty(); + } + List res = page.getRecords().stream() + .map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); + BeanUtil.copyProperties(appraisalProject,vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); + vo.setAppraisalId(planId); + return vo; + }) + .collect(Collectors.toList()); + + return PageVo.of(res,page.getTotal()); } /** * 是否可以自评 - * @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 && + Objects.isNull(appraisalProject.getSelfAppraisalScoreTime())){ return Boolean.TRUE; } return Boolean.FALSE; } + + public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(String projectCode) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String regionCode = user.getRegionCode(); + + ProjectAppraisalIndexDetailVO vo = new ProjectAppraisalIndexDetailVO(); + + // 根据项目编码获取最新版本的项目信息 + Project project = projectService.getProjectByCode(projectCode); + VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); + // 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 + Integer projectType = project.getProjectType(); + Integer projectYear = project.getProjectYear(); + BigDecimal approvalAmount = project.getApprovalAmount(); + VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); + // 根据项目code获取项目标签ID列表 + List tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) + .eq(ProjectTag::getProjectCode, projectCode)).stream() + .map(ProjectTag::getTagId).collect(Collectors.toList()); + VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); + + List strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); + String projectTagIds = String.join(StrPool.COMMA, strIdList); + + Integer amountRange = null; + if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) < 0){ + amountRange = BizConst.AMOUNT_RANGE_ONE; + } else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.FIVE_MILLION)) >= 0 && + approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) < 0) { + amountRange = BizConst.AMOUNT_RANGE_TWO; + }else if (approvalAmount.compareTo(BigDecimal.valueOf(BizConst.TWENTY_MILLION)) >= 0){ + amountRange = BizConst.AMOUNT_RANGE_THREE; + } + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) + .eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) + .eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) + .eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) + .eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) + .eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds) + .orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); + PerformanceIndicatorProjectTemplate projectTemplate = indicatorProjectTemplateService.getOne(wrapper); + + if (Objects.isNull(projectTemplate)){ + throw new BizException("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); + } + // 装配项目指标详情及分数信息 + // 获取模版绩效指标详情 + List templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId())); + // 获取模版附加绩效指标详情 + List additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) + .eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); + List templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,vo); + List additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,vo); + vo.setProjectName(project.getProjectName()); + vo.setBuildOrgName(project.getBuildOrgName()); + vo.setProjectStatus(project.getStatus()); + vo.setProjectYear(projectYear); + vo.setApprovalAmount(approvalAmount); + vo.setTemplateDetails(templateDetailVos); + vo.setAdditionalIndexDetails(additionalTemplateDetailVos); + return vo; + } + + @Transactional(rollbackFor = Exception.class) + public String submitSelfAppraisal(ProjectAppraisalDTO param) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + String username = userDetail.getUsername(); + Long appraisalId = param.getAppraisalId(); + Long appraisalProjectId = param.getAppraisalProjectId(); + String appraisalProjectCode = param.getAppraisalProjectCode(); + List appraisalInfoList = param.getAppraisalInfoList(); + // 判断该项目是否还存在于计划或分组中 + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId) + .eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode)); + if (Objects.isNull(appraisalProject)){ + throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!"); + } + // 根据项目模板详情ID保存自评得分、打分时间 + if (CollUtil.isEmpty(appraisalInfoList)){ + throw new BizException("填写所有自评得分后才能提交!"); + } + List ids = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId) + .collect(Collectors.toList()); + // 查出项目模版详情信息 + List detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); + if (CollUtil.isEmpty(detailList)){ + throw new BizException("评价指标不存在!"); + } + Map detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); + List scoreInfos = appraisalInfoList.stream().map(a -> { + PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = templateDetail.getIndexScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("自评得分必须大于等于0且小于等于指标分值!"); + } + // 保存自评分数信息 + PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo(); + scoreInfo.setAppraisalBasis(a.getAppraisalBasis()); + scoreInfo.setAppraisalScore(a.getScore()); + scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix()); + scoreInfo.setAppraisalType(AppraisalTypeEnum.SELF_APPRAISAL.getCode()); + scoreInfo.setTemplateDetailId(templateDetail.getId()); + scoreInfo.setTemplateId(templateDetail.getTemplateId()); + scoreInfo.setAppraisalEmployeeCode(employeeCode); + scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalId(appraisalId); + scoreInfo.setAppraisalProjectId(appraisalProjectId); + scoreInfo.setAppraisalProjectCode(appraisalProjectCode); + scoreInfo.setCreateOn(LocalDateTime.now()); + scoreInfo.setCreateBy(username); + return scoreInfo; + }).collect(Collectors.toList()); + + if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ + // 计算自评总分并保存 + BigDecimal selfAppraisalTotalScore = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + appraisalProject.setSelfAppraisalTotalScore(selfAppraisalTotalScore); + appraisalProject.setSelfAppraisalScoreTime(LocalDateTime.now()); + appraisalProject.setIsCompleteSelfAppraisal(Boolean.TRUE); + appraisalProject.setUpdateOn(LocalDateTime.now()); + appraisalProject.setUpdateBy(username); + performanceAppraisalProjectService.updateById(appraisalProject); + return "提交成功"; + } + return "提交失败"; + } } 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..7c1252f 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,35 @@ 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); + if (StringUtils.isNotBlank(g.getVerifyLeader())){ + UserFullInfoDTO dto = userInfoHelper.getUserFullInfoByEmployeeCode(g.getVerifyLeader()); + groupVo.setVerifyLeader(dto); + } + groupVo.setCreateOn(g.getCreateOn()); + return groupVo; + }).collect(Collectors.toList()); + vo.setGroups(groups); + } return vo; } @@ -199,25 +244,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 +325,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 +344,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 +389,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 +410,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 +427,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 +471,20 @@ 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); + // 删除评级计划关联的分组信息 + groupService.remove(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .eq(PerformanceAppraisalProjectGroup::getAppraisalId,id)); return "删除成功"; } return "删除失败"; @@ -393,8 +493,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,11 +507,15 @@ 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)){ - List users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes); + List users = Lists.newArrayList(); + for (String employeeCode : allEmployeeCodes) { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + users.add(userFullInfo); + } if(CollUtil.isNotEmpty(users)){ userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); } @@ -436,9 +541,13 @@ 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)); + if (StringUtils.isNotBlank(g.getVerifyLeader())){ + UserFullInfoDTO userFullInfoDto = finalUserMap.get(g.getVerifyLeader()); + vo.setVerifyLeader(userFullInfoDto); + } return vo; }).collect(Collectors.toList()); } @@ -457,8 +566,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)); @@ -469,7 +578,11 @@ public class PerformanceAppraisalPlanManage { allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getReAppraisalUsers())); allEmployeeCodes.addAll(CodeUtil.convertStrToList(group.getVerificationUsers())); if(CollUtil.isNotEmpty(allEmployeeCodes)){ - List users = userInfoHelper.getUserFullInfoByEmployeeCodes(allEmployeeCodes); + List users = Lists.newArrayList(); + for (String employeeCode : allEmployeeCodes) { + UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + users.add(userFullInfoDto); + } if(CollUtil.isNotEmpty(users)){ userMap = users.stream().collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode,u -> u)); } @@ -483,9 +596,13 @@ 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)); + if (StringUtils.isNotBlank(group.getVerifyLeader())){ + UserFullInfoDTO dto = userMap.get(group.getVerifyLeader()); + vo.setVerifyLeader(dto); + } return vo; } @@ -498,24 +615,74 @@ 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()); group.setCreateBy(user.getUsername()); }else{ + // 编辑分组 PerformanceAppraisalProjectGroup old = groupService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(old)).throwMessage("该分组不存在 编辑失败!"); group.setId(old.getId()); + // 先删除旧的分组 + groupList.remove(old); } 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()); + List compareCodes = Lists.newArrayList(); + for (String projectCode : projectCodeList) { + if (projectCode.contains(StrPool.COMMA)){ + List codes = Arrays.asList(projectCode.split(StrPool.COMMA)); + compareCodes.addAll(codes); + }else { + compareCodes.add(projectCode); + } + } + checkProjectCodes(dto.getProjectCodes(),compareCodes); + 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()); + List compareUsers = Lists.newArrayList(); + for (String reUser : reUserList) { + if (reUser.contains(StrPool.COMMA)){ + List users = Arrays.asList(reUser.split(StrPool.COMMA)); + compareUsers.addAll(users); + }else { + compareUsers.add(reUser); + } + } + checkReAppraisalAndVerifyUsers(dto.getReAppraisalUsers(),compareUsers,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()); + List compareUsers = Lists.newArrayList(); + for (String verifyUser : verifyList) { + if (verifyUser.contains(StrPool.COMMA)){ + List users = Arrays.asList(verifyUser.split(StrPool.COMMA)); + compareUsers.addAll(users); + }else { + compareUsers.add(verifyUser); + } + } + checkReAppraisalAndVerifyUsers(dto.getVerificationUsers(),compareUsers,CommonConst.VERIFY_TYPE); + group.setVerificationUsers(String.join(StrPool.COMMA, dto.getVerificationUsers())); } group.setUpdateOn(LocalDateTime.now()); group.setUpdateBy(user.getUsername()); @@ -523,6 +690,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 +744,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,9 +758,10 @@ 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()); + vo.setProjectId(project.getId()); vo.setProjectCode(projectCode); vo.setProjectYear(project.getProjectYear()); vo.setDeclareAmount(project.getDeclareAmount()); @@ -572,8 +774,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/manage/ReAppraisalManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java new file mode 100644 index 0000000..9d8bbbd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/ReAppraisalManage.java @@ -0,0 +1,333 @@ +package com.ningdatech.pmapi.performance.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import com.google.common.collect.Lists; +import org.apache.commons.lang3.StringUtils; +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.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.StrPool; +import com.ningdatech.pmapi.performance.constant.BizConst; +import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; +import com.ningdatech.pmapi.performance.model.entity.*; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; +import com.ningdatech.pmapi.performance.service.*; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * ReAppraisalManage + * @return + * @author CMM + * @since 2023/08/10 8:55 + */ +@Component +@Slf4j +@AllArgsConstructor +public class ReAppraisalManage { + + private final IPerformanceAppraisalService performanceAppraisalService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IProjectService projectService; + private final IRoleService roleService; + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + private final IPerformanceAppraisalProjectGroupService groupService; + /** + * 复评-评价计划列表 + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + //当前登录用户 单位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, BizConst.REAPPRAISAL_ROLE)); + if (Objects.isNull(role)){ + throw new BizException("登录用户没有复评员角色!"); + } + + // 登录用户不是复评员,不能查看复评计划列表 + if (!roleIdList.contains(role.getId())){ + return PageVo.empty(); + } + + // 从绩效评价 项目表中获取已经完成单位自评的项目 + List paps = performanceAppraisalProjectService.list().stream() + .filter(p -> Objects.nonNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); + + // 已存在的评价计划添加的评价项目都未完成单位自评 + if(CollUtil.isEmpty(paps)){ + return PageVo.empty(); + } + Set paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); + + // 获取评价计划关联的分组信息 + List groups = groupService.list(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) + .in(PerformanceAppraisalProjectGroup::getAppraisalId, paIds)); + // 获取当前登录复评员所在的分组信息 + List groupList = groups.stream().filter(g -> { + String reAppraisalUsers = g.getReAppraisalUsers(); + List empCodeList = Arrays.stream(reAppraisalUsers.split(StrPool.COMMA)).collect(Collectors.toList()); + if (empCodeList.contains(employeeCode)) { + return true; + } + return false; + }).collect(Collectors.toList()); + // 当前登录复评员用户,没有参加评价计划 + if (CollUtil.isEmpty(groupList)){ + return PageVo.empty(); + } + // 获取分组所在的评价计划ID + List appraisalIds = groupList.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList()); + // 因为同一个复评员只能出现在一个计划的一个分组中,所以分组信息可按照评价计划ID进行分组 + Map groupMap = groupList.stream().collect(Collectors.toMap(PerformanceAppraisalProjectGroup::getAppraisalId, g -> g)); + // 获取复评计划列表 + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId,appraisalIds) + .orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page,wrapper); + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); + PerformanceAppraisalProjectGroup group = groupMap.get(p.getId()); + if (Objects.nonNull(group)) { + vo.setReAppraisalGroupId(group.getId()); + vo.setReAppraisalGroupName(group.getName()); + } + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + /** + * 是否可以复评 + * + * @param employeeCode + * @param projectCode + * @param appraisalId + * @return + */ + private Boolean checkCanReAppraisal(String employeeCode, String projectCode, Long appraisalId) { + // 首次复评(复评打分时间为空) + // 从绩效评价打分信息表中查询打分类型为复评、打分人员为当前登录复评用户的打分信息 + // 如果没有相关的打分信息,说明是当前登录复评用户是首次复评 + List scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId,appraisalId) + .eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode)); + if (CollUtil.isEmpty(scoreInfos)){ + return true; + } + return Boolean.FALSE; + } + + public PageVo groupProjectList(Long groupId, PerformanceAppraisalListReq req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + + // 获取分组内的项目信息 + PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId); + String projectCodes = projectGroup.getProjectCodes(); + Long appraisalId = projectGroup.getAppraisalId(); + VUtils.isTrue(StringUtils.isBlank(projectCodes)).throwMessage("分组内项目信息不存在!"); + List projectCodeList = Arrays.stream(projectCodes.split(StrPool.COMMA)).collect(Collectors.toList()); + + // 筛选出分组内已完成单位自评、需要复评的评价项目信息 + List appraisalProjects = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getProjectCode, projectCodeList) + .eq(PerformanceAppraisalProject::getIsReAppraisal,Boolean.TRUE) + .eq(PerformanceAppraisalProject::getIsCompleteSelfAppraisal, Boolean.TRUE)); + // 分组内已完成单位自评的项目信息不存在 + if (CollUtil.isEmpty(appraisalProjects)){ + return PageVo.empty(); + } + List proCodeList = appraisalProjects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + Map appraisalProjectMap = appraisalProjects.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectCode, p -> p)); + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, proCodeList) + .eq(Project::getNewest, Boolean.TRUE) + .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); + projectService.page(page,wrapper); + + // 分组内项目信息不存在 + if (CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + PerformanceAppraisalProject appraisalProject = appraisalProjectMap.get(p.getProjectCode()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setCanReAppraisal(checkCanReAppraisal(employeeCode,appraisalProject.getProjectCode(),appraisalId)); + if (Boolean.TRUE.equals(appraisalProject.getIsCompleteReAppraisal())){ + // 完成复评的项目可以进行核查 + vo.setCanVerify(Boolean.TRUE); + } + vo.setGroupId(groupId); + return vo; + }) + .collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String submitReAppraisal(ProjectAppraisalDTO param) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + String username = userDetail.getUsername(); + Long appraisalId = param.getAppraisalId(); + Long appraisalProjectId = param.getAppraisalProjectId(); + String appraisalProjectCode = param.getAppraisalProjectCode(); + List appraisalInfoList = param.getAppraisalInfoList(); + Long groupId = param.getGroupId(); + PerformanceAppraisalProjectGroup group = groupService.getById(groupId); + + // 获取评价项目 + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId) + .eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode)); + + List ids = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId) + .collect(Collectors.toList()); + // 查出项目模版详情信息 + List detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); + if (CollUtil.isEmpty(detailList)){ + throw new BizException("评价指标不存在!"); + } + Map detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); + List scoreInfos = appraisalInfoList.stream().map(a -> { + PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = templateDetail.getIndexScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("复评得分必须大于等于0且小于等于指标分值!"); + } + // 保存复评分数信息 + PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo(); + scoreInfo.setAppraisalBasis(a.getAppraisalBasis()); + scoreInfo.setAppraisalScore(a.getScore()); + scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix()); + scoreInfo.setAppraisalType(AppraisalTypeEnum.RE_APPRAISAL.getCode()); + scoreInfo.setTemplateDetailId(templateDetail.getId()); + scoreInfo.setTemplateId(templateDetail.getTemplateId()); + scoreInfo.setAppraisalEmployeeCode(employeeCode); + scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalId(appraisalId); + scoreInfo.setAppraisalProjectId(appraisalProjectId); + scoreInfo.setAppraisalProjectCode(appraisalProjectCode); + scoreInfo.setCreateOn(LocalDateTime.now()); + scoreInfo.setCreateBy(username); + return scoreInfo; + }).collect(Collectors.toList()); + + if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ + // 计算复评总分并保存 + BigDecimal reAppraisalTotalScore = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal lastReappraisalTotalScore; + // 判断项目所在分组内其他复评人员是否已经打分 + if (Objects.nonNull(appraisalProject.getReAppraisalTotalScore())){ + // 已经进行了复评,计算两个分值的平均分 + BigDecimal add = reAppraisalTotalScore.add(appraisalProject.getReAppraisalTotalScore()); + lastReappraisalTotalScore = add.divide(BigDecimal.valueOf(2)); + }else { + // 还没有进行过复评 + lastReappraisalTotalScore = reAppraisalTotalScore; + } + appraisalProject.setReAppraisalTotalScore(lastReappraisalTotalScore); + // 取最新地复评打分时间 + appraisalProject.setReAppraisalScoreTime(LocalDateTime.now()); + // 判断当前复评人是否为该评价项目所在分组的复评人员中的最后一个复评人 + judgeCompleteReAppraisal(group, appraisalProject); + appraisalProject.setUpdateOn(LocalDateTime.now()); + appraisalProject.setUpdateBy(username); + performanceAppraisalProjectService.updateById(appraisalProject); + return "提交成功"; + } + return "提交失败"; + } + + private void judgeCompleteReAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) { + Map> scoreInfoMap = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())) + .stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode)); + + List reUsers = Lists.newArrayList(); + String reAppraisalUsers = group.getReAppraisalUsers(); + String projectCodes = group.getProjectCodes(); + if (reAppraisalUsers.contains(StrPool.COMMA)){ + reUsers = Arrays.asList(reAppraisalUsers.split(StrPool.COMMA)); + }else { + reUsers.add(reAppraisalUsers); + } + List users = Lists.newArrayList(); + for (String reUser : reUsers) { + // 获取分组内复评人员对分组内项目的复评分数信息 + List scoreInfoList = scoreInfoMap.get(reUser); + if (CollUtil.isNotEmpty(scoreInfoList)){ + List projectIdList = scoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalProjectId) + .collect(Collectors.toList()); + List proCodes = projectService.listByIds(projectIdList).stream() + .map(Project::getProjectCode) + .collect(Collectors.toList()); + // 当前登录用户所在分组的复评人员 对分组内所有项目进行了复评 + if (CollUtil.isNotEmpty(proCodes)){ + String join = String.join(StrPool.COMMA, proCodes); + if (join.equals(projectCodes)) { + users.add(reUser); + } + } + } + } + if (CollUtil.isNotEmpty(users)) { + String join = String.join(StrPool.COMMA, users); + if (join.equals(reAppraisalUsers)) { + // 标记项目完成复评 + appraisalProject.setIsCompleteReAppraisal(Boolean.TRUE); + } + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java new file mode 100644 index 0000000..66e7d01 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/manage/VerifyManage.java @@ -0,0 +1,332 @@ +package com.ningdatech.pmapi.performance.manage; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +import com.google.common.collect.Lists; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; +import org.apache.commons.lang3.StringUtils; +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.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.StrPool; +import com.ningdatech.pmapi.performance.enumration.AppraisalTypeEnum; +import com.ningdatech.pmapi.performance.helper.TemplateDetailBuildHelper; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalDTO; +import com.ningdatech.pmapi.performance.model.dto.ProjectAppraisalInfoDTO; +import com.ningdatech.pmapi.performance.model.entity.*; +import com.ningdatech.pmapi.performance.model.req.PerformanceAppraisalListReq; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalProjectVO; +import com.ningdatech.pmapi.performance.model.vo.PerformanceAppraisalVO; +import com.ningdatech.pmapi.performance.service.*; +import com.ningdatech.pmapi.portrait.service.IProjectTagService; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +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.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * VerifyManage + * @return + * @author CMM + * @since 2023/08/10 8:55 + */ +@Component +@Slf4j +@AllArgsConstructor +public class VerifyManage { + + private final IPerformanceAppraisalService performanceAppraisalService; + private final IPerformanceAppraisalProjectService performanceAppraisalProjectService; + private final IProjectService projectService; + private final IRoleService roleService; + private final IPerformanceIndicatorProjectTemplateService indicatorProjectTemplateService; + private final TemplateDetailBuildHelper templateDetailBuildHelper; + private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; + private final IProjectTagService projectTagService; + private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; + private final IPerformanceAppraisalProjectGroupService groupService; + /** + * 核查-评价计划列表 + * @param req + * @return + */ + public PageVo list(PerformanceAppraisalListReq req) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String employeeCode = user.getEmployeeCode(); + // 获取当前登录用户的角色列表,只有专家核查人员才能查看该列表 + 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.EXPERT.getDesc())); + if (Objects.isNull(role)){ + throw new BizException("登录用户没有复评员角色!"); + } + + // 登录用户不是专家,不能查看核查计划列表 + if (!roleIdList.contains(role.getId())){ + return PageVo.empty(); + } + + // 从绩效评价 分组表中获取当前登录专家所在的分组信息 + List groups = Lists.newArrayList(); + List projectGroups = groupService.list(); + for (PerformanceAppraisalProjectGroup projectGroup : projectGroups) { + String verificationUsers = projectGroup.getVerificationUsers(); + if (verificationUsers.contains(StrPool.COMMA)){ + if (verificationUsers.contains(employeeCode)){ + groups.add(projectGroup); + } + } else if (verificationUsers.equals(employeeCode)) { + groups.add(projectGroup); + } + } + // 当前登录专家没有绩效分组信息 + if (CollUtil.isEmpty(groups)){ + return PageVo.empty(); + } + + // 获取分组所在的评价计划ID + List appraisalIds = groups.stream().map(PerformanceAppraisalProjectGroup::getAppraisalId).collect(Collectors.toList()); + // 因为同一个核查人员只能出现在一个计划的一个分组中,所以分组信息可按照评价计划ID进行分组 + Map groupMap = groups.stream().collect(Collectors.toMap(PerformanceAppraisalProjectGroup::getAppraisalId, g -> g)); + // 获取核查计划列表 + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) + .in(PerformanceAppraisal::getId,appraisalIds) + .orderByDesc(PerformanceAppraisal::getUpdateOn); + performanceAppraisalService.page(page,wrapper); + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalVO.class); + PerformanceAppraisalProjectGroup group = groupMap.get(p.getId()); + if (Objects.nonNull(group)) { + vo.setReAppraisalGroupId(group.getId()); + vo.setReAppraisalGroupName(group.getName()); + } + return vo; + }).collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + /** + * 是否可以核查 + * + * @param employeeCode + * @param projectCode + * @param appraisalId + * @return + */ + private Boolean checkCanVerify(String employeeCode, String projectCode, Long appraisalId) { + + // 首次核查(核查打分信息为空) + // 从绩效评价打分信息表中查询打分类型为专家核查、打分人员为当前登录专家用户的打分信息 + // 如果没有相关的打分信息,说明是当前登录复评用户是首次核查 + List scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode()) + .eq(PerformanceAppraisalScoreInfo::getAppraisalId,appraisalId) + .eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) + .eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode)); + if (CollUtil.isEmpty(scoreInfos)){ + return true; + } + return Boolean.FALSE; + } + + public PageVo groupProjectList(Long groupId, PerformanceAppraisalListReq req) { + + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + + // 获取分组内的项目信息 + PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId); + String projectCodes = projectGroup.getProjectCodes(); + Long appraisalId = projectGroup.getAppraisalId(); + VUtils.isTrue(StringUtils.isBlank(projectCodes)).throwMessage("分组内项目信息不存在!"); + List projectCodeList = Arrays.stream(projectCodes.split(StrPool.COMMA)).collect(Collectors.toList()); + + // 筛选出分组内已完成复评的评价项目信息 + List appraisalProjects = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .in(PerformanceAppraisalProject::getProjectCode, projectCodeList) + .eq(PerformanceAppraisalProject::getIsCompleteReAppraisal, Boolean.TRUE)); + // 分组内已完成复评的项目信息不存在 + if (CollUtil.isEmpty(appraisalProjects)){ + return PageVo.empty(); + } + List proCodeList = appraisalProjects.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toList()); + Map appraisalProjectMap = appraisalProjects.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectCode, p -> p)); + + Page page = req.page(); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Project.class) + .in(Project::getProjectCode, proCodeList) + .eq(Project::getNewest, Boolean.TRUE) + .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); + projectService.page(page,wrapper); + + // 分组内项目信息不存在 + if (CollUtil.isEmpty(page.getRecords())){ + return PageVo.empty(); + } + + List res = page.getRecords().stream().map(p -> { + PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); + PerformanceAppraisalProject appraisalProject = appraisalProjectMap.get(p.getProjectCode()); + BeanUtil.copyProperties(appraisalProject, vo); + vo.setProjectId(appraisalProject.getProjectId()); + vo.setProjectTypeName(ProjectTypeEnum.getDesc(p.getProjectType())); + vo.setCanVerify(checkCanVerify(employeeCode,appraisalProject.getProjectCode(),appraisalId)); + // 如果登录用户是核查组长,该项目可填写整改意见 + String verifyLeader = projectGroup.getVerifyLeader(); + if (employeeCode.equals(verifyLeader)){ + vo.setCanRectify(Boolean.TRUE); + } + return vo; + }) + .collect(Collectors.toList()); + return PageVo.of(res,page.getTotal()); + } + + @Transactional(rollbackFor = Exception.class) + public String submitVerify(ProjectAppraisalDTO param) { + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String employeeCode = userDetail.getEmployeeCode(); + String username = userDetail.getUsername(); + Long appraisalId = param.getAppraisalId(); + Long appraisalProjectId = param.getAppraisalProjectId(); + String appraisalProjectCode = param.getAppraisalProjectCode(); + List appraisalInfoList = param.getAppraisalInfoList(); + Long groupId = param.getGroupId(); + PerformanceAppraisalProjectGroup group = groupService.getById(groupId); + + // 获取评价项目 + PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) + .eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) + .eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode) + .eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)); + + List ids = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getProjectTemplateDetailId) + .collect(Collectors.toList()); + // 查出项目模版详情信息 + List detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) + .in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); + if (CollUtil.isEmpty(detailList)){ + throw new BizException("评价指标不存在!"); + } + Map detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); + List scoreInfos = appraisalInfoList.stream().map(a -> { + PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); + BigDecimal score = a.getScore(); + BigDecimal indexScore = templateDetail.getIndexScore(); + if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ + throw new BizException("核查得分必须大于等于0且小于等于指标分值!"); + } + // 保存核查分数信息 + PerformanceAppraisalScoreInfo scoreInfo = new PerformanceAppraisalScoreInfo(); + scoreInfo.setAppraisalBasis(a.getAppraisalBasis()); + scoreInfo.setAppraisalScore(a.getScore()); + scoreInfo.setAppraisalBasisAppendix(a.getAppraisalBasisAppendix()); + scoreInfo.setAppraisalType(AppraisalTypeEnum.EXPERT_VERIFY.getCode()); + scoreInfo.setTemplateDetailId(templateDetail.getId()); + scoreInfo.setTemplateId(templateDetail.getTemplateId()); + scoreInfo.setAppraisalEmployeeCode(employeeCode); + scoreInfo.setAppraisalEmployeeName(username); + scoreInfo.setAppraisalId(appraisalId); + scoreInfo.setAppraisalProjectId(appraisalProjectId); + scoreInfo.setAppraisalProjectCode(appraisalProjectCode); + scoreInfo.setCreateOn(LocalDateTime.now()); + scoreInfo.setCreateBy(username); + return scoreInfo; + }).collect(Collectors.toList()); + + if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ + // 计算核查总分并保存 + BigDecimal verifyTotalScore = appraisalInfoList.stream() + .map(ProjectAppraisalInfoDTO::getScore) + .filter(Objects::nonNull) + .reduce(BigDecimal.ZERO, BigDecimal::add); + BigDecimal lastVerifyTotalScore; + // 判断项目所在分组内其他复评人员是否已经打分 + if (Objects.nonNull(appraisalProject.getVerifyTotalScore())){ + // 已经进行了核查,计算两个分值的平均分 + BigDecimal add = verifyTotalScore.add(appraisalProject.getReAppraisalTotalScore()); + lastVerifyTotalScore = add.divide(BigDecimal.valueOf(2)); + }else { + // 还没有进行过复评 + lastVerifyTotalScore = verifyTotalScore; + } + appraisalProject.setReAppraisalTotalScore(lastVerifyTotalScore); + // 取最新地核查打分时间 + appraisalProject.setVerifyScoreTime(LocalDateTime.now()); + // 判断当前核查人是否为该评价项目所在分组的核查人员中的最后一个核查人 + judgeCompleteVerify(group, appraisalProject); + appraisalProject.setUpdateOn(LocalDateTime.now()); + appraisalProject.setUpdateBy(username); + if (Objects.nonNull(param.getIsRectify()) || + StringUtils.isNotBlank(param.getRectifyOpinion())) { + appraisalProject.setIsRectify(param.getIsRectify()); + appraisalProject.setRectifyOpinion(param.getRectifyOpinion()); + } + performanceAppraisalProjectService.updateById(appraisalProject); + return "提交成功"; + } + return "提交失败"; + } + + private void judgeCompleteVerify(PerformanceAppraisalProjectGroup group, PerformanceAppraisalProject appraisalProject) { + Map> scoreInfoMap = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) + .eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) + .stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode)); + + List verifyUsers = Lists.newArrayList(); + String verificationUsers = group.getVerificationUsers(); + String projectCodes = group.getProjectCodes(); + if (verificationUsers.contains(StrPool.COMMA)){ + verifyUsers = Arrays.asList(verificationUsers.split(StrPool.COMMA)); + }else { + verifyUsers.add(verificationUsers); + } + List users = Lists.newArrayList(); + for (String verifyUser : verifyUsers) { + // 获取分组内核查人员对分组内项目的核查分数信息 + List scoreInfoList = scoreInfoMap.get(verifyUser); + if (CollUtil.isNotEmpty(scoreInfoList)){ + List projectIdList = scoreInfoList.stream() + .map(PerformanceAppraisalScoreInfo::getAppraisalProjectId) + .collect(Collectors.toList()); + List proCodes = projectService.listByIds(projectIdList).stream() + .map(Project::getProjectCode) + .collect(Collectors.toList()); + // 当前登录用户所在分组的核查人员 对分组内所有项目进行了核查 + if (CollUtil.isNotEmpty(proCodes)){ + String join = String.join(StrPool.COMMA, proCodes); + if (join.equals(projectCodes)) { + users.add(verifyUser); + } + } + } + } + if (CollUtil.isNotEmpty(users)) { + String join = String.join(StrPool.COMMA, users); + if (join.equals(verificationUsers)) { + appraisalProject.setIsCompleteVerify(Boolean.TRUE); + } + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.java new file mode 100644 index 0000000..e262a88 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.performance.mapper; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author CMM + * @since 2023-08-09 + */ +public interface PerformanceAppraisalScoreInfoMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml new file mode 100644 index 0000000..b5be0ac --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/mapper/PerformanceAppraisalScoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + 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/dto/PerformanceAppraisalProjectGroupSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java index e78b1be..4799285 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceAppraisalProjectGroupSaveDTO.java @@ -43,4 +43,7 @@ public class PerformanceAppraisalProjectGroupSaveDTO implements Serializable { @ApiModelProperty("核查人员") private List verificationUsers; + + @ApiModelProperty("核查组长") + private String verifyLeader; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java index 5cc508e..31e646f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/PerformanceIndicatorProjectTemplateSaveDTO.java @@ -48,4 +48,7 @@ public class PerformanceIndicatorProjectTemplateSaveDTO implements Serializable @ApiModelProperty("附加绩效指标详情") private List additionalIndexDetails; + + @ApiModelProperty("项目标签信息") + private List projectTagIds; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java new file mode 100644 index 0000000..0d0be8d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalDTO.java @@ -0,0 +1,42 @@ +package com.ningdatech.pmapi.performance.model.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 项目评价信息 + * @return + * @author CMM + * @since 2023/08/08 18:46 + */ +@Data +public class ProjectAppraisalDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("评价项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("评价项目Code") + private String appraisalProjectCode; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + + @ApiModelProperty("项目模板指标详情评价信息集合") + private List appraisalInfoList; + + @ApiModelProperty("项目是否需要整改") + private Boolean isRectify; + + @ApiModelProperty("整改意见") + private String rectifyOpinion; + + @ApiModelProperty("评价项目所在分组ID") + private Long groupId; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalInfoDTO.java new file mode 100644 index 0000000..f6a839b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/dto/ProjectAppraisalInfoDTO.java @@ -0,0 +1,37 @@ +package com.ningdatech.pmapi.performance.model.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 项目评价信息 + * @return + * @author CMM + * @since 2023/08/08 18:46 + */ +@Data +public class ProjectAppraisalInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目模板指标详情ID") + private Long projectTemplateDetailId; + + @ApiModelProperty("评价得分") + @NotNull(message = "得分不能为空!") + private BigDecimal score; + + @ApiModelProperty("评价依据") + @Size(max = 500) + private String appraisalBasis; + + @ApiModelProperty("评价依据附件") + private String appraisalBasisAppendix; +} 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..eb11971 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 @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.performance.model.entity; +import com.alibaba.fastjson.annotation.JSONField; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -8,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; import java.time.LocalDateTime; /** @@ -41,6 +43,46 @@ public class PerformanceAppraisalProject implements Serializable { @ApiModelProperty("项目编码") private String projectCode; - @ApiModelProperty("是否核查") + @ApiModelProperty("是否复评") private Boolean isReAppraisal; + + @ApiModelProperty("自评开始时间") + private LocalDateTime selfAppraisalStart; + + @ApiModelProperty("自评结束时间") + private LocalDateTime selfAppraisalEnd; + + @ApiModelProperty("自评总分") + private BigDecimal selfAppraisalTotalScore; + + @ApiModelProperty("自评打分时间") + private LocalDateTime selfAppraisalScoreTime; + + @ApiModelProperty("复评总分") + private BigDecimal reAppraisalTotalScore; + + @ApiModelProperty("复评打分时间") + private LocalDateTime reAppraisalScoreTime; + + @ApiModelProperty("核查总分") + private BigDecimal verifyTotalScore; + + @ApiModelProperty("核查打分时间") + private LocalDateTime verifyScoreTime; + + @ApiModelProperty("项目是否需要整改") + private Boolean isRectify; + + @ApiModelProperty("整改意见") + private String rectifyOpinion; + + @ApiModelProperty("是否完成自评") + private Boolean isCompleteSelfAppraisal; + + @ApiModelProperty("是否完成复评") + private Boolean isCompleteReAppraisal; + + @ApiModelProperty("是否完成核查") + private Boolean isCompleteVerify; + } 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..9027e46 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,12 +38,15 @@ public class PerformanceAppraisalProjectGroup implements Serializable { @ApiModelProperty("计划id") private Long appraisalId; - @ApiModelProperty("分组内的所有项目id") - private String projectIds; + @ApiModelProperty("分组内的所有项目code") + private String projectCodes; @ApiModelProperty("复评人员") private String reAppraisalUsers; @ApiModelProperty("核查人员") private String verificationUsers; + + @ApiModelProperty("核查组长") + private String verifyLeader; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java new file mode 100644 index 0000000..12e9fb3 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/entity/PerformanceAppraisalScoreInfo.java @@ -0,0 +1,73 @@ +package com.ningdatech.pmapi.performance.model.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author CMM + * @since 2023-08-09 + */ +@Data +@TableName("nd_performance_appraisal_score_info") +@ApiModel(value = "NdPerformanceAppraisalScoreInfo对象", description = "") +public class PerformanceAppraisalScoreInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("创建人") + private String createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime updateOn; + + @ApiModelProperty("更新人") + private String updateBy; + + @ApiModelProperty("项目评价计划模板ID") + private Long templateId; + + @ApiModelProperty("项目评价计划模板详情ID") + private Long templateDetailId; + + @ApiModelProperty("评价得分") + private BigDecimal appraisalScore; + + @ApiModelProperty("评价依据") + private String appraisalBasis; + + @ApiModelProperty("评价依据附件") + private String appraisalBasisAppendix; + + @ApiModelProperty("评价人员code") + private String appraisalEmployeeCode; + + @ApiModelProperty("评价人员姓名") + private String appraisalEmployeeName; + + @ApiModelProperty("评价类型 1 单位自评、2 复评人员复评、3 专家核查") + private Integer appraisalType; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + + @ApiModelProperty("评价项目ID") + private Long appraisalProjectId; + + @ApiModelProperty("评价项目Code") + private String appraisalProjectCode; +} 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..667f34f 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 @@ -10,6 +10,7 @@ import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; /** * @Classname PerformanceIndicatorTemplate @@ -53,4 +54,7 @@ public class PerformanceIndicatorProjectTemplate implements Serializable { @ApiModelProperty("项目资金范围 1.500万元以下、2.500-2000万元,3.2000万元及以上") private Integer amountRange; + + @ApiModelProperty("项目标签信息") + private String projectTagIds; } 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/PerformanceAppraisalProjectGroupVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java index 333e8a4..ad6cac2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/PerformanceAppraisalProjectGroupVO.java @@ -43,4 +43,7 @@ public class PerformanceAppraisalProjectGroupVO implements Serializable { @ApiModelProperty("核查人员") private List verificationUsers; + + @ApiModelProperty("核查组长") + private UserFullInfoDTO verifyLeader; } 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..9db9130 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,6 +1,6 @@ package com.ningdatech.pmapi.performance.model.vo; -import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; +import com.alibaba.fastjson.annotation.JSONField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -8,7 +8,6 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.List; /** * @Classname PerformanceAppraisalProjectVO @@ -23,7 +22,7 @@ public class PerformanceAppraisalProjectVO implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty("项目ID") - private Long id; + private Long projectId; @ApiModelProperty("项目编码") private String projectCode; @@ -51,4 +50,53 @@ public class PerformanceAppraisalProjectVO implements Serializable { @ApiModelProperty("是否可自评") private Boolean canSelfAppraisal = Boolean.FALSE; + + @ApiModelProperty("是否可复评") + private Boolean canReAppraisal = Boolean.FALSE; + + @ApiModelProperty("是否可核查") + private Boolean canVerify = Boolean.FALSE; + + @ApiModelProperty("是否可整改") + private Boolean canRectify = Boolean.FALSE; + + @ApiModelProperty("自评开始时间") + private LocalDateTime selfAppraisalStart; + + @ApiModelProperty("自评结束时间") + private LocalDateTime selfAppraisalEnd; + + @ApiModelProperty("自评总分") + private BigDecimal selfAppraisalTotalScore; + + @ApiModelProperty("自评打分时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime selfAppraisalScoreTime; + + @ApiModelProperty("复评总分") + private BigDecimal reAppraisalTotalScore; + + @ApiModelProperty("复评打分时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime reAppraisalScoreTime; + + @ApiModelProperty("核查总分") + private BigDecimal verifyTotalScore; + + @ApiModelProperty("核查打分时间") + @JSONField(format = "yyyy-MM-dd HH:mm") + private LocalDateTime verifyScoreTime; + + @ApiModelProperty("项目是否需要整改") + private Boolean isRectify; + + @ApiModelProperty("整改意见") + private String rectifyOpinion; + + @ApiModelProperty("评价计划ID") + private Long appraisalId; + + @ApiModelProperty("所在分组ID") + private Long groupId; + } 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..25db559 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,29 @@ 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; + + @ApiModelProperty("复评分组ID") + private Long reAppraisalGroupId; + + @ApiModelProperty("复评分组名称") + private String reAppraisalGroupName; + + @ApiModelProperty("核查分组ID") + private Long verifyGroupId; + + @ApiModelProperty("核查分组名称") + private String verifyGroupName; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java new file mode 100644 index 0000000..0b26c1e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectAppraisalIndexDetailVO.java @@ -0,0 +1,52 @@ +package com.ningdatech.pmapi.performance.model.vo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 项目评价指标 + * @return + * @author CMM + * @since 2023/08/08 8:55 + */ +@Data +@ApiModel(value = "项目自(复)评项目指标模版详情", description = "项目自(复)评项目指标模版详情") +public class ProjectAppraisalIndexDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("申报单位") + private String buildOrgName; + + @ApiModelProperty("项目状态") + private Integer projectStatus; + + @ApiModelProperty("批复金额") + private BigDecimal approvalAmount; + + @ApiModelProperty("预算年度") + private Integer projectYear; + + @ApiModelProperty("绩效指标详情") + private List templateDetails; + + @ApiModelProperty("附加绩效指标详情") + private List additionalIndexDetails; + + @ApiModelProperty("自评总得分") + private BigDecimal selfAppraisalTotalScore; + + @ApiModelProperty("复评总得分") + private BigDecimal reAppraisalTotalScore; + + @ApiModelProperty("核查总得分") + private BigDecimal verifyTotalScore; +} 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..fad699c 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 @@ -50,9 +50,14 @@ public class ProjectIndexTemplateVO implements Serializable { @ApiModelProperty("状态 0关闭 1开启") private Integer status; + @ApiModelProperty("项目标签信息") + private List projectTagIds; + @ApiModelProperty("绩效指标详情") private List templateDetails; @ApiModelProperty("附加绩效指标详情") private List additionalIndexDetails; + + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java index c4d4b1d..2166577 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/model/vo/ProjectTemplateDetailVO.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.performance.model.vo; +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -7,6 +8,7 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; +import java.util.Map; /** * @Classname PerformanceIndicatorProjectTemplateDetail @@ -20,6 +22,9 @@ public class ProjectTemplateDetailVO implements Serializable { private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + private Long id; + @ApiModelProperty("关联模板ID") private Long templateId; @@ -52,4 +57,20 @@ public class ProjectTemplateDetailVO implements Serializable { @ApiModelProperty("子指标") private List children; + + @ApiModelProperty("自评分数信息") + private List selfAppraisalScoreInfo; + + @ApiModelProperty("复评分数信息") + private Map> reAppraisalScoreInfo; + + @ApiModelProperty("复评得分信息") + private Map reAppraisalTotalScoreInfo; + + @ApiModelProperty("核查分数信息") + private Map> verifyScoreInfo; + + @ApiModelProperty("核查得分信息") + private Map verifyTotalScoreInfo; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalScoreInfoService.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalScoreInfoService.java new file mode 100644 index 0000000..d9e0ee6 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/IPerformanceAppraisalScoreInfoService.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.performance.service; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author CMM + * @since 2023-08-09 + */ +public interface IPerformanceAppraisalScoreInfoService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java new file mode 100644 index 0000000..5b6ad52 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/performance/service/impl/PerformanceAppraisalScoreInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.ningdatech.pmapi.performance.service.impl; + +import com.ningdatech.pmapi.performance.model.entity.PerformanceAppraisalScoreInfo; +import com.ningdatech.pmapi.performance.mapper.PerformanceAppraisalScoreInfoMapper; +import com.ningdatech.pmapi.performance.service.IPerformanceAppraisalScoreInfoService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author CMM + * @since 2023-08-09 + */ +@Service +public class PerformanceAppraisalScoreInfoServiceImpl extends ServiceImpl implements IPerformanceAppraisalScoreInfoService { + +} 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..26f97a8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java @@ -0,0 +1,204 @@ +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.common.constant.RegionConst; +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() + "标签"); + if(!RegionConst.RC_LS.equals(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/contants/ProjectCodeContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java new file mode 100644 index 0000000..c1b870e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.projectdeclared.contants; + +/** + * @Classname ProjectCodeContant + * @Description + * @Date 2023/8/10 15:20 + * @Author PoffyZhang + */ +public interface ProjectCodeContant { + + String REGION_LAST_3 = "000"; + + String PROJECT_TYPE_PREFIX = "0"; + + String SHUZI_5 = "%05d"; +} 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/controller/DeclaredProjectController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java index afe69b1..5a7d991 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java @@ -1,19 +1,13 @@ package com.ningdatech.pmapi.projectdeclared.controller; -import java.util.Iterator; - import javax.servlet.http.HttpServletResponse; import com.ningdatech.log.annotation.WebLog; -import org.apache.commons.lang3.StringUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage; import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectListParamDTO; @@ -53,22 +47,10 @@ public class DeclaredProjectController { @ApiOperation(value = "核心业务列表", notes = "核心业务列表") @GetMapping("/core-biz") - public JSONObject bizList(@RequestParam(required = false) String businessName) { - JSONObject jsonObject = JSONObject.parseObject(DeclaredProjectContant.Biz.CORE_BIZ); - if(StringUtils.isNotBlank(businessName)){ - JSONArray dataArray = JSONArray.parseArray(jsonObject.getString("data")); - Iterator iter = dataArray.stream().iterator(); - JSONArray dataArrayRes = new JSONArray(); - while (iter.hasNext()) { - JSONObject value = (JSONObject) iter.next(); - String businessValue = value.getString("matterName"); - if(StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)){ - dataArrayRes.add(value); - } - } - jsonObject.put("data",dataArrayRes); - } - return jsonObject; + public JSONObject bizList(@RequestParam(required = false) String businessName, + @RequestParam(required = false) Integer pageSize, + @RequestParam(required = false) Integer pageNumber) { + return declaredProjectManage.bizList(businessName,pageSize,pageNumber); } @ApiOperation(value = "申报项目草稿箱列表", notes = "申报项目草稿箱列表") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java index 22db56a..a5a2702 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DelayedApplyController.java @@ -4,7 +4,6 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.projectdeclared.manage.DelayedApplyManage; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; import com.ningdatech.pmapi.projectdeclared.model.dto.DelayedApplyDTO; import com.ningdatech.pmapi.projectdeclared.model.vo.DelayedApplyVO; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; @@ -16,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.util.List; /** * @Classname DelayedProjectController @@ -39,6 +39,12 @@ public class DelayedApplyController { return delayedApplyManage.projectLibList(req); } + @ApiOperation(value = "查看某个项目的延期列表", notes = "查看某个项目的延期列表") + @GetMapping("/delay-list/{projectId}") + public List delayList(@PathVariable Long projectId) { + return delayedApplyManage.delayList(projectId); + } + @ApiOperation(value = "延期的内容详情", notes = "延期的内容详情") @GetMapping("/detail/{projectId}") public DelayedApplyVO detailByProjectId(@PathVariable Long projectId) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/FinalAcceptanceController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/FinalAcceptanceController.java index abb27bb..388e2f0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/FinalAcceptanceController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/FinalAcceptanceController.java @@ -59,4 +59,12 @@ public class FinalAcceptanceController { String instanceId = finalAcceptanceManage.startProcess(dto); return "终验申报 【" + instanceId + "】 成功"; } + + @ApiOperation(value = "终验申报重新提交", notes = "终验申报重新提交") + @WebLog("终验申报重新提交") + @PostMapping("/restart-process") + public String restartTheProcess(@Validated @RequestBody DefaultDeclaredDTO dto) { + String instanceId = finalAcceptanceManage.restartProcess(dto); + return "终验申报 【" + instanceId + "】 成功"; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java index b3ca651..733cdd2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionManage.java @@ -119,6 +119,8 @@ public class ConstructionManage { item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); item.setApprovedAmount(w.getApprovalAmount()); item.setApprovalDate(w.getApprovalDate()); + item.setTransactionAmount(w.getTransactionAmount()); + item.setTransactionTime(w.getTransactionTime()); return item; }); return PageVo.of(records, total); @@ -332,6 +334,8 @@ public class ConstructionManage { item.setDeliveryTime(w.getDeliveryTime()); item.setContractAmount(w.getContractAmount()); item.setAnnualPlanAmount(w.getAnnualPlanAmount()); + item.setTransactionTime(w.getTransactionTime()); + item.setTransactionAmount(w.getTransactionAmount()); return item; }); return PageVo.of(records, total); @@ -364,6 +368,10 @@ public class ConstructionManage { exportDTO.setDeliveryTime(r.getDeliveryTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); exportDTO.setContractAmount(r.getContractAmount()); exportDTO.setAnnualPlanAmount(r.getAnnualPlanAmount()); + if(Objects.nonNull(r.getTransactionTime())){ + exportDTO.setTransactionTime(r.getTransactionTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + } + exportDTO.setTransactionAmount(r.getTransactionAmount()); return exportDTO; }).collect(Collectors.toList()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java index ce6f302..e367d4a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java @@ -171,7 +171,7 @@ public class ConstructionPlanManage { defaultDeclaredProjectManage.buildCondition(params, dto); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, constructProject); - 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/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index fe7bea6..587856a 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 @@ -3,6 +3,8 @@ package com.ningdatech.pmapi.projectdeclared.manage; import cn.hutool.core.collection.CollUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -19,6 +21,8 @@ import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; +import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; +import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; import com.ningdatech.pmapi.projectdeclared.model.dto.*; import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO; @@ -37,6 +41,7 @@ import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; import com.ningdatech.pmapi.sys.manage.NoticeManage; import com.ningdatech.pmapi.todocenter.constant.WorkNoticeConstant; 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.bean.entity.WflowModels; import com.wflow.exception.BusinessException; @@ -44,10 +49,12 @@ import com.wflow.workflow.bean.dto.OrgInfoDTO; import com.wflow.workflow.bean.vo.ProcessStartParamsVo; import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessModelService; +import io.swagger.models.auth.In; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -87,6 +94,11 @@ public class DeclaredProjectManage { private final RegionCacheHelper regionCacheHelper; + private final ProjectIrsManage projectIrsManage; + + @Value("${spring.profiles.active}") + private String active; + /** * 新项目 启动实例 * @@ -154,7 +166,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); //如果是重新提交的话 判断下 项目是否存在 @@ -240,7 +252,7 @@ public class DeclaredProjectManage { Project project = new Project(); BeanUtils.copyProperties(projectDto,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); //保存项目相关 @@ -414,4 +426,41 @@ public class DeclaredProjectManage { throw new RuntimeException(e); } } + + /** + * 查询 核心业务 + * @param businessName + * @return + */ + public JSONObject bizList(String businessName,Integer limit, Integer page) { + JSONObject jsonObject = new JSONObject(); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + if(BizConst.DEV.equals(active)){ + jsonObject = JSONObject.parseObject(DeclaredProjectContant.Biz.CORE_BIZ); + if(CollUtil.isEmpty(jsonObject)){ + return jsonObject; + } + if(StringUtils.isNotBlank(businessName)){ + JSONArray dataArray = JSONArray.parseArray(jsonObject.getString("data")); + if(CollUtil.isEmpty(dataArray)){ + return new JSONObject(); + } + Iterator iter = dataArray.stream().iterator(); + JSONArray dataArrayRes = new JSONArray(); + while (iter.hasNext()) { + JSONObject value = (JSONObject) iter.next(); + String businessValue = value.getString("matterName"); + if(StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)){ + dataArrayRes.add(value); + } + } + jsonObject.put("data",dataArrayRes); + jsonObject.put("total",dataArrayRes.size()); + } + }else if(BizConst.PRE.equals(active) || + BizConst.PROD.equals(active)){ + jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); + } + return jsonObject; + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java index 956116a..f7883f5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DelayedApplyManage.java @@ -298,10 +298,28 @@ public class DelayedApplyManage { .eq(ProjectDelayApply::getProjectId, projectId) .orderByDesc(ProjectDelayApply::getCreateOn) .last(BizConst.LIMIT_1)); - if(Objects.isNull(delayApply)){ return null; } return BeanUtil.copyProperties(delayApply,DelayedApplyVO.class); } + + /** + * 查看某个项目的 延期列表 + * @param projectId + * @return + */ + public List delayList(Long projectId) { + List allVersionProjectId = projectService.getAllVersionProjectId(projectId); + List delays = projectDelayApplyService.list(Wrappers.lambdaQuery(ProjectDelayApply.class) + .in(ProjectDelayApply::getProjectId, allVersionProjectId) + .eq(ProjectDelayApply::getSuccess, Boolean.TRUE)); + + if(CollUtil.isEmpty(delays)){ + return Collections.emptyList(); + } + + return delays.stream().map(d -> BeanUtil.copyProperties(d,DelayedApplyVO.class)) + .collect(Collectors.toList()); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java index 5fa6eb9..13de572 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/FinalAcceptanceManage.java @@ -206,9 +206,6 @@ public class FinalAcceptanceManage { String regionCode = projectInfo.getAreaCode(); - //放入终验材料 - projectInfo.setFinalAcceptanceMaterials(projectDto.getFinalAcceptanceMaterials()); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) @@ -233,13 +230,13 @@ public class FinalAcceptanceManage { declaredProjectManage.buildCondition(params, dto); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); - String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); + String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); log.info("终验方案项目申报成功 【{}】", instanceId); //保存终验项目 //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, - InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, + InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.FALSE); //发送给第一个审批人消息 noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, @@ -267,9 +264,6 @@ public class FinalAcceptanceManage { String regionCode = projectInfo.getAreaCode(); - //放入终验材料 - projectInfo.setFinalAcceptanceMaterials(projectDto.getFinalAcceptanceMaterials()); - WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) .eq(WflowModels::getRegionCode, regionCode) .eq(WflowModels::getProcessType, ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS.getCode()) @@ -294,12 +288,12 @@ public class FinalAcceptanceManage { declaredProjectManage.buildCondition(params, dto); // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 Map orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); - String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(), model.getFormId(), params, orgModelMap); + String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); log.info("终验方案项目重新申报成功 【{}】", instanceId); //保存终验项目 //生成新版本 并且进入下一状态 - projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId, + projectInfo = projectLibManage.saveProjectWithVersionAndPass(projectInfo,instanceId,projectDto, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode(),Boolean.TRUE); //发送给第一个审批人消息 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java index 0dbee64..7a33308 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/OperationManage.java @@ -81,6 +81,8 @@ public class OperationManage { entity.setProjectCode(project.getProjectCode()); entity.setUpdateOn(LocalDateTime.now()); entity.setUpdateBy(user.getUsername()); + //强制放入 计划终验时间 + entity.setFinalInspectionDate(project.getPlanAcceptanceTime()); if(operationService.saveOrUpdate(entity)){ stateMachineUtils.pass(project); project.setUpdateOn(LocalDateTime.now()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index 00e5ec5..b8b85bd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -194,7 +194,7 @@ public class PrequalificationDeclaredProjectManage { // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,projectInfo); - String instanceId = processInstanceService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); + String instanceId = processInstanceService.startProcessLs(model, params,orgModelMap); log.info("提交预审项目成功 【{}】", instanceId); log.info("restart 【{}】", restart); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java index 7f71b70..751a23d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PurchaseManage.java @@ -209,7 +209,7 @@ public class PurchaseManage { // 获取总的成交时间及金额 LocalDateTime lastTransactionTime = null; BigDecimal transactionAmountTotal = BigDecimal.ZERO; - for (Purchase purchase : purchases) { + for (Purchase purchase : purchaseEntities) { if (lastTransactionTime == null) { lastTransactionTime = purchase.getTransactionTime(); } else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java index 577c0c5..3491627 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java @@ -97,7 +97,7 @@ public class ReviewByDeptJointManage { // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 Map orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,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/projectdeclared/utils/GenerateProjectCodeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java index 93788b4..166e8ec 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -1,13 +1,8 @@ package com.ningdatech.pmapi.projectdeclared.utils; -import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ningdatech.basic.exception.BizException; -import com.ningdatech.basic.util.StrPool; -import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService; -import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; -import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; +import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; @@ -15,8 +10,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectCollectionService; import com.ningdatech.pmapi.projectlib.service.IProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - -import java.util.List; +import java.time.LocalDateTime; import java.util.Objects; /** @@ -37,68 +31,38 @@ public class GenerateProjectCodeUtil { private IProjectCollectionService projectCollectionService; public String generateProjectCode(ProjectDTO project){ - // 获取所属行政区划代码(6位) - String areaCode = project.getAreaCode(); - // 获取建设年度后两位 - String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS); - // 9-12位固定 - String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER; - // 获取公司的财政编码 - CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode()); - - // 从表中查出单位配置的财政编码 - if (Objects.isNull(companyFiscalCode)){ - throw new BizException("申报单位未配置财政编码!"); - } - - String fiscalCode = companyFiscalCode.getFiscalCode(); - // 获取项目编号 - String projectIdStr; - // 获取项目库当前最大项目序号 - List projectList = projectService.list(Wrappers.lambdaQuery(Project.class).orderByDesc(Project::getId)); - Project maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0); - Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1; - if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){ - // 超过999的项目号从1开始 1 - Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID; - projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId); - }else { - projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId); - } - // 生成21位的项目编号 - return areaCode + year + fixedNumber + fiscalCode + projectIdStr; + // 获取所属行政区划代码(9位) + String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; + // 获取建设年度 (10-13) + String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) + : String.valueOf(LocalDateTime.now().getYear()); + // 14-15 项目类型 + String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType(); + // 16-20 项目序号00001 + Long max = projectService.count(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectYear,project.getProjectYear()) + .eq(Project::getNewest,Boolean.TRUE)); + Long maxCurrent = max + 1; + String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent); + // 生成20位的项目编号 + return areaCode + year + projectType + serialNumber; } public String generateProjectCode(ProjectCollection project){ - // 获取所属行政区划代码(6位) - String areaCode = project.getAreaCode(); - // 获取建设年度后两位 - String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS); - // 9-12位固定 - String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER; - // 获取公司的财政编码 - CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode()); - - // 从表中查出单位配置的财政编码 - if (Objects.isNull(companyFiscalCode)){ - throw new BizException("申报单位未配置财政编码!"); - } - - String fiscalCode = companyFiscalCode.getFiscalCode(); - // 获取项目编号 - String projectIdStr; - // 获取项目库当前最大项目序号 - List projectList = projectCollectionService.list(Wrappers.lambdaQuery(ProjectCollection.class).orderByDesc(ProjectCollection::getId)); - ProjectCollection maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0); - Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1; - if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){ - // 超过999的项目号从1开始 1 - Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID; - projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId); - }else { - projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId); - } - // 生成21位的项目编号 - return areaCode + year + fixedNumber + fiscalCode + projectIdStr; + // 获取所属行政区划代码(9位) + String areaCode = project.getAreaCode() + ProjectCodeContant.REGION_LAST_3; + // 获取建设年度 (10-13) + String year = Objects.nonNull(project.getProjectYear()) ? String.valueOf(project.getProjectYear()) + : String.valueOf(LocalDateTime.now().getYear()); + // 14-15 项目类型 + String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType(); + // 16-20 项目序号00001 + Long max = projectService.count(Wrappers.lambdaQuery(Project.class) + .eq(Project::getProjectYear,project.getProjectYear()) + .eq(Project::getNewest,Boolean.TRUE)); + Long maxCurrent = max + 1; + String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent); + // 生成20位的项目编号 + return areaCode + year + projectType + serialNumber; } } 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/enumeration/WarningFlowTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningFlowTypeEnum.java new file mode 100644 index 0000000..891d926 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningFlowTypeEnum.java @@ -0,0 +1,58 @@ +package com.ningdatech.pmapi.projectlib.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 预警填报类型枚举 + * @author CMM + * @since 2023/02/24 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum WarningFlowTypeEnum { + /** + * 预警填报类型枚举 + */ + UNIT_INNER_AUDIT(1, "预审申报",ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()), + PRELIMINARY_PREVIEW(2, "建设方案申报",ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()), + DEPT_UNITED_REVIEW(3,"采购结果备案",ProjectStatusEnum.TO_BE_PURCHASED.getCode()), + CONSTRUCTION_PLAN_REVIEW(4,"初验备案",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()), + PROJECT_FINAL_INSPECTION(5,"验收申报",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + + private Integer code; + private String desc; + + //对应的 待提交时的项目状态 + private Integer projectStutas; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (WarningFlowTypeEnum t : WarningFlowTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static WarningFlowTypeEnum getByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (WarningFlowTypeEnum t : WarningFlowTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningOperationTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningOperationTypeEnum.java new file mode 100644 index 0000000..3ca2276 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/WarningOperationTypeEnum.java @@ -0,0 +1,55 @@ +package com.ningdatech.pmapi.projectlib.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 预警填报类型枚举 + * @author CMM + * @since 2023/02/24 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum WarningOperationTypeEnum { + /** + * 预警实施类型枚举 + */ + CHUYAN(1, "项目初验",ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()), + ZHONGYAN(2, "项目终验",ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); + + private Integer code; + private String desc; + + //对应的 待提交时的项目状态 + private Integer projectStutas; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (WarningOperationTypeEnum t : WarningOperationTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static WarningOperationTypeEnum getByCode(Integer code) { + if (Objects.isNull(code)) { + return null; + } + for (WarningOperationTypeEnum t : WarningOperationTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t; + } + } + return null; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java index 67b843e..037e537 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java @@ -1,6 +1,9 @@ package com.ningdatech.pmapi.projectlib.handle; import java.util.*; +import java.util.stream.Collectors; + +import cn.hutool.core.collection.CollUtil; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.projectlib.model.entity.Project; @@ -68,14 +71,16 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { void businessHandle(Long projectId, List processSchedule) { ProcessDetailVO processDetailVO = new ProcessDetailVO(); - Project project = projectService.getById(projectId); + Project project = projectService.getNewProject(projectId); //查出历史版本的 所有项目ID List allVersionProjectIds = projectService.getAllVersionProjectId(project); Integer status = project.getStatus(); - List fieldList = CollUtils.fieldList(PROJECT_APPROVAL_LIST_STATUS, ProjectStatusEnum::getCode); + if(Objects.isNull(status)){ + return; + } // 项目状态为待立项批复之前的状态 - if (fieldList.contains(status)){ + if (status < ProjectStatusEnum.TO_BE_APPROVED.getCode()){ processDetailVO.setStepStatus(StepStatusEnum.NOT_START); processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); processSchedule.add(processDetailVO); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java index c938cb0..0ce4d34 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java @@ -1,5 +1,6 @@ package com.ningdatech.pmapi.projectlib.helper; +import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -11,6 +12,9 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; import cn.hutool.core.collection.CollUtil; +import java.util.List; +import java.util.Map; + /** *

* ProjectHelper @@ -65,6 +69,16 @@ public class ProjectHelper { * @param app * @return */ + public static ProjectApplicationVO convertVOWithMap(ProjectApplication app, + Map> coreBizMap) { + ProjectApplicationVO appVo = new ProjectApplicationVO(); + BeanUtils.copyProperties(app, appVo); + if(coreBizMap.containsKey(app.getId())){ + List projectCoreBusinessIndicators = coreBizMap.get(app.getId()); + appVo.setCoreBusinessList(projectCoreBusinessIndicators); + } + return appVo; + } public static ProjectApplicationVO convertVO(ProjectApplication app) { ProjectApplicationVO appVo = new ProjectApplicationVO(); BeanUtils.copyProperties(app, appVo); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java index 069841d..5ea60b7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java @@ -7,11 +7,9 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.poi.excel.ExcelUtil; -import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -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; @@ -21,15 +19,12 @@ import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.enumeration.CommonEnum; -import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.ExcelDownUtil; -import com.ningdatech.pmapi.common.util.ExcelExportStyle; import com.ningdatech.pmapi.datascope.model.DataScopeDTO; import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; -import com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectLibFlagEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; @@ -44,11 +39,11 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.req.StartProjectDeclareReq; import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; -import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; +import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.todocenter.constant.TodoCenterConstant; 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 lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -58,20 +53,12 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; - -import static com.ningdatech.pmapi.expert.constant.ExpertUserInfoSensitiveFieldEnum.UnitType.list; import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; /** @@ -88,11 +75,11 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; public class AnnualPlanLibManage { private final IProjectService projectService; + + private final IProjectApplicationService applicationService; private final StateMachineUtils stateMachine; - private final INdProjectStatusChangeService statusChangeService; private final UserInfoHelper userInfoHelper; private final IProjectRenewalFundDeclarationService projectRenewalFundDeclarationService; - private final RegionCacheHelper regionCacheHelper; /** * 年度计划查询状态 @@ -159,19 +146,35 @@ public class AnnualPlanLibManage { @Transactional(rollbackFor = Exception.class) public void projectApproved(ProjectApprovedReq req) { - Project project = projectService.getById(req.getProjectId()); + Project oldProject = projectService.getById(req.getProjectId()); + Project project = BeanUtil.copyProperties(oldProject, Project.class); + // 被撤回重新申报的项目,项目ID要置空 + project.setCreateOn(LocalDateTime.now()); + project.setUpdateOn(LocalDateTime.now()); stateMachine.pass(project); //计划出 计划验收时间 LocalDateTime planAcceptanceTime = getPlanAcceptanceTime(req); - LambdaUpdateWrapper update = - Wrappers.lambdaUpdate(Project.class).set(Project::getApprovalAmount, req.getApprovedAmount()) - .set(Project::getApprovedFile, req.getApprovedFileId()).set(Project::getBuildCycle, req.getBuildCycle()) - .set(Project::getApprovedConstructionPlanFile, req.getBuildPlanFileId()) - .set(Project::getApprovalDate, req.getApprovedDate()).set(Project::getStatus, project.getStatus()) - .set(Project::getStage, project.getStage()) - .set(Objects.nonNull(planAcceptanceTime),Project::getPlanAcceptanceTime,planAcceptanceTime) - .eq(Project::getId, req.getProjectId()); - projectService.update(update); + project.setApprovalAmount(req.getApprovedAmount()); + project.setApprovedFile(String.valueOf(req.getApprovedFileId())); + project.setBuildCycle(String.valueOf(req.getBuildCycle())); + project.setOriginBuildCycle(req.getBuildCycle()); + project.setApprovedConstructionPlanFile(String.valueOf(req.getBuildPlanFileId())); + project.setApprovalDate(req.getApprovedDate()); + project.setPlanAcceptanceTime(planAcceptanceTime); + project.setOriginPlanAcceptanceTime(planAcceptanceTime); + // 项目编号不变,版本号加1 + project.setProjectCode(oldProject.getProjectCode()); + project.setVersion(oldProject.getVersion() + 1); + project.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + project.setId(null); + if(projectService.save(project)){ + applicationService.saveApplication(project,oldProject,Boolean.TRUE); + // 将旧的项目版本置为不是最新 + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest, Boolean.FALSE) + .ne(Project::getId, project.getId()) + .eq(Project::getProjectCode, project.getProjectCode())); + } } public LocalDateTime getPlanAcceptanceTime(ProjectApprovedReq req){ 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..5e92531 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,22 @@ 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.ProjectRenewalApprovalStatusEnum; 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,9 +60,17 @@ 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; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.exception.BusinessException; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -114,6 +119,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); @@ -122,6 +136,22 @@ public class ProjectLibManage { if ((total = page.getTotal()) == 0) { return PageVo.empty(); } + + //已验收项目ID + List acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus())) + .map(Project::getId).collect(Collectors.toList()); + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(acceptedProjectId)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectId, acceptedProjectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); + } + + Map> finalRenewalMap = renewalMap; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -140,6 +170,14 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); + if(finalRenewalMap.containsKey(item.getId())){ + List prfs = finalRenewalMap.get(item.getId()); + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); + item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs)); + }else{ + item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); + item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList())); + } return item; }); return PageVo.of(records, total); @@ -156,6 +194,40 @@ 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; + + //已验收项目ID + List acceptedProjectId = page.getRecords().stream().filter(p -> ProjectStatusEnum.ACCEPTED.getCode().equals(p.getStatus())) + .map(Project::getId).collect(Collectors.toList()); + + Map> renewalMap = Maps.newHashMap(); + if(CollUtil.isNotEmpty(acceptedProjectId)){ + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .in(ProjectRenewalFundDeclaration::getProjectId, acceptedProjectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + renewalMap = renewalDeclarations.stream().collect(Collectors.groupingBy(ProjectRenewalFundDeclaration::getProjectId)); + } + + Map> finalRenewalMap = renewalMap; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -180,18 +252,324 @@ public class ProjectLibManage { && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } + item.setApprovedAmount(w.getApprovalAmount()); + item.setAnnualPlanAmount(w.getAnnualPlanAmount()); item.setPrePlanProjectId(w.getPrePlanProjectId()); + setTag(item,finalTagMap,finalTagNameMap); + if(finalRenewalMap.containsKey(item.getId())){ + List prfs = finalRenewalMap.get(item.getId()); + item.setAnnualAccumulateAmount(computeAmount(w.getAnnualPlanAmount(),prfs)); + item.setAnnualAccumulateAmountList(convertAccmulate(w,prfs)); + }else{ + item.setAnnualAccumulateAmount(w.getAnnualPlanAmount()); + item.setAnnualAccumulateAmountList(convertAccmulate(w,Collections.emptyList())); + } return item; }); return PageVo.of(records, total); } + private BigDecimal computeAmount(BigDecimal cuurentAmount,List prfs) { + BigDecimal res = cuurentAmount; + for(ProjectRenewalFundDeclaration prf : prfs){ + res = res.add(prf.getAnnualPaymentAmount()); + } + return res; + } + + private List convertAccmulate(Project project,List prfs) { + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(project.getId()) + .projectYear(project.getProjectYear()) + .annualAmount(project.getAnnualPlanAmount()) + .build()); + for(ProjectRenewalFundDeclaration prf : prfs){ + annualAmounts.add(AnnualAmountVO.builder() + .projectId(prf.getProjectId()) + .projectYear(prf.getProjectYear()) + .annualAmount(prf.getAnnualPaymentAmount()) + .build()); + } + return annualAmounts; + } + + 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); } /** + * @param projectId 项目详情 + * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO + * @author ZPF + * @since 2023/02/11 11:15 + */ + public ProjectDetailVO getProjectDetail(Long projectId) { + // 查询最新的项目申报信息 + Project projectInfo = projectService.getNewProject(projectId); + if (Objects.isNull(projectInfo)) { + return null; + } + ProjectDetailVO vo = new ProjectDetailVO(); + BeanUtils.copyProperties(projectInfo, vo); + vo.buildDynamicForm(projectInfo.getDynamicForm()); + // 查询应用 + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) + .eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) + .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); + + List applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); + + //核心业务 + if(CollUtil.isNotEmpty(applicationIds)){ + List coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); + Map> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId)); + + Optional.ofNullable(applications).ifPresent(apps -> + vo.setProjectApplications(CollUtils.convert(apps, + app -> ProjectHelper.convertVOWithMap(app,coreBizMap)) + )); + } + + List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); + //查询采购备案 + List purchases = purchaseService.listByProjectId(projectId); + vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); + + //查询合同备案 + Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) + .in(Contract::getProjectId, allVersionProjectId) + .last(BizConst.LIMIT_1)); + ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); + vo.setContract(contractVO); + List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) + .in(PaymentPlan::getProjectId, allVersionProjectId) + .orderByAsc(PaymentPlan::getPaymentTime)); + if (Objects.nonNull(contractVO)) { + contractVO.setPayments(convertPayments(payments, + 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) + .in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) + .orderByAsc(PreInsAcceptancePerson::getCreateOn)); + vo.setAcceptancePersons(convertPersons(acceptancePersons)); + + //查询终验信息 + //查询年度投资金额 要是已验收的项目 + if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(projectInfo.getProjectYear()) + .annualAmount(projectInfo.getAnnualPlanAmount()) + .build()); + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, projectInfo.getId()) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> + declarations.forEach(declaration -> { + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); + } + // 处理文件名 + List fileIdList = new ArrayList<>(); + BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); + BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); + if (!fileIdList.isEmpty()) { + List files = fileService.listByIds(fileIdList); + Map fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); + vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); + vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); + } + return vo; + } + + /** + * @param projectId 项目详情 不查询最新版本 + * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO + * @author ZPF + * @since 2023/02/11 11:15 + */ + public ProjectDetailVO getProjectDetailThisVersion(Long projectId) { + // 查询最新的项目申报信息 + Project projectInfo = projectService.getById(projectId); + if (Objects.isNull(projectInfo)) { + return null; + } + ProjectDetailVO vo = new ProjectDetailVO(); + BeanUtils.copyProperties(projectInfo, vo); + vo.buildDynamicForm(projectInfo.getDynamicForm()); + // 查询应用 + List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) + .eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) + .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); + + List applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); + + //核心业务 + if(CollUtil.isNotEmpty(applicationIds)){ + List coreBizs = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); + Map> coreBizMap = coreBizs.stream().collect(Collectors.groupingBy(ProjectCoreBusinessIndicators::getApplicationId)); + + Optional.ofNullable(applications).ifPresent(apps -> + vo.setProjectApplications(CollUtils.convert(apps, + app -> ProjectHelper.convertVOWithMap(app,coreBizMap)) + )); + } + + //审批信息 + ProcessDetailReq req = new ProcessDetailReq(); + req.setInstanceId(projectInfo.getInstCode()); + req.setProjectId(projectId); + vo.setProcess(todoService.getProcessDetail(req)); + + List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); + //查询采购备案 + List purchases = purchaseService.listByProjectId(projectId); + vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); + + //查询合同备案 + Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) + .in(Contract::getProjectId, allVersionProjectId) + .last(BizConst.LIMIT_1)); + ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); + vo.setContract(contractVO); + List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) + .in(PaymentPlan::getProjectId, allVersionProjectId) + .orderByAsc(PaymentPlan::getPaymentTime)); + if (Objects.nonNull(contractVO)) { + contractVO.setPayments(convertPayments(payments, + 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) + .in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) + .orderByAsc(PreInsAcceptancePerson::getCreateOn)); + vo.setAcceptancePersons(convertPersons(acceptancePersons)); + + //查询终验信息 + //查询年度投资金额 要是已验收的项目 + if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(projectInfo.getProjectYear()) + .annualAmount(projectInfo.getAnnualPlanAmount()) + .build()); + List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> + declarations.forEach(declaration -> { + annualAmounts.add(AnnualAmountVO.builder() + .projectId(projectInfo.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); + } + // 处理文件名 + List fileIdList = new ArrayList<>(); + BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); + BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); + if (!fileIdList.isEmpty()) { + List files = fileService.listByIds(fileIdList); + Map fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); + vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); + vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); + } + return vo; + } + + /** * 申报新项目时 保存项目信息和其它相关联的信息 * * @param projectDto @@ -201,7 +579,7 @@ public class ProjectLibManage { */ public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, String employeeCode) { - Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode); + Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode,Boolean.FALSE); //保存项目和实例的关系 ProjectInst projectInst = new ProjectInst(); projectInst.setProjectId(project.getId()); @@ -253,7 +631,7 @@ public class ProjectLibManage { * @return */ public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, - String employeeCode) { + String employeeCode,Boolean isContruct) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { Project project = new Project(); @@ -273,7 +651,7 @@ public class ProjectLibManage { } } else { //否则是重新提交的 新生成一个新版本的项目 - project = newProjectWithVersion(projectDto); + project = newProjectWithVersion(projectDto,isContruct); if (Objects.nonNull(project)) { project.setInstCode(instanceId); project.setSponsor(employeeCode); @@ -326,7 +704,7 @@ public class ProjectLibManage { project.setPrePlanProjectId(oldProject.getId()); } if(projectService.save(project)){ - saveApplication(projectDto,project,null); + saveApplication(projectDto,project,Boolean.TRUE); // 将旧的项目版本置为不是最新 projectService.update(Wrappers.lambdaUpdate(Project.class) @@ -337,7 +715,7 @@ public class ProjectLibManage { } else { //否则是被驳回,重新提交的 新生成一个新版本的项目 - project = newProjectWithVersion(projectDto); + project = newProjectWithVersion(projectDto,Boolean.TRUE); if (Objects.nonNull(project)) { project.setInstCode(instanceId); project.setSponsor(employeeCode); @@ -358,10 +736,10 @@ public class ProjectLibManage { * @param projectDto * @return */ - public Project reSaveProjectNewVersion(ProjectDTO projectDto) { + public Project reSaveProjectNewVersion(ProjectDTO projectDto,Boolean isContruct) { //流程启动之后 入库项目 重要业务信息 用于列表查询 展示 try { - return newProjectWithVersion(projectDto); + return newProjectWithVersion(projectDto,isContruct); } catch (Exception e) { log.error("项目信息入库错误 " + e); throw new BusinessException("项目信息入库错误 :" + e); @@ -372,7 +750,7 @@ public class ProjectLibManage { * 重新提交工作流时 舍弃在原有项目修改 * 新增一个新的项目 新的版本号 */ - public Project newProjectWithVersion(ProjectDTO projecDto) { + public Project newProjectWithVersion(ProjectDTO projecDto,Boolean isContruct) { Project oldProject = projectService.getById(projecDto.getId()); Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) @@ -397,7 +775,7 @@ public class ProjectLibManage { .ne(Project::getId, project.getId()) .eq(Project::getProjectCode, project.getProjectCode())); - saveApplication(projecDto,project,null); + saveApplication(projecDto,project,isContruct); return project; } @@ -510,7 +888,7 @@ public class ProjectLibManage { return project; } - public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId, Integer instType,Boolean isBackReject) { + public Project saveProjectWithVersionAndPass(Project oldProject, String instanceId,ProjectDTO dto, Integer instType,Boolean isBackReject) { Project project = new Project(); VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); @@ -524,9 +902,11 @@ public class ProjectLibManage { // 标识保存的项目信息是否为建设方案申报项目 project.setIsConstruct(Boolean.FALSE); project.setIsBackReject(isBackReject); + //终验材料 + project.setFinalAcceptanceMaterials(dto.getFinalAcceptanceMaterials()); stateMachineUtils.pass(project); - oldProject.setIsBackReject(Boolean.TRUE); + oldProject.setIsBackReject(isBackReject); projectService.updateById(oldProject); if (projectService.save(project)) { @@ -591,188 +971,6 @@ public class ProjectLibManage { } /** - * @param projectId 项目详情 - * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO - * @author ZPF - * @since 2023/02/11 11:15 - */ - public ProjectDetailVO getProjectDetail(Long projectId) { - // 查询最新的项目申报信息 - Project projectInfo = projectService.getNewProject(projectId); - if (Objects.isNull(projectInfo)) { - return null; - } - ProjectDetailVO vo = new ProjectDetailVO(); - BeanUtils.copyProperties(projectInfo, vo); - vo.buildDynamicForm(projectInfo.getDynamicForm()); - // 查询应用 - List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) - .eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) - .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); - - Optional.ofNullable(applications).ifPresent(apps -> - vo.setProjectApplications(CollUtils.convert(apps, - ProjectHelper::convertVO) - )); - - List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); - //查询采购备案 - List purchases = purchaseService.listByProjectId(projectId); - vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); - - //查询合同备案 - Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) - .in(Contract::getProjectId, allVersionProjectId) - .last(BizConst.LIMIT_1)); - ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); - vo.setContract(contractVO); - List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) - .in(PaymentPlan::getProjectId, allVersionProjectId) - .orderByAsc(PaymentPlan::getPaymentTime)); - if (Objects.nonNull(contractVO)) { - contractVO.setPayments(convertPayments(payments, - contractVO.getTotalAmount())); - } - - - //查询初验信息 - List acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) - .orderByAsc(PreInsAcceptancePerson::getCreateOn)); - vo.setAcceptancePersons(convertPersons(acceptancePersons)); - - //查询终验信息 - //查询年度投资金额 要是已验收的项目 - if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { - List annualAmounts = Lists.newArrayList(); - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(projectInfo.getProjectYear()) - .annualAmount(projectInfo.getAnnualPlanAmount()) - .build()); - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .build()); - }) - ); - vo.setAnnualAccumulateAmountList(annualAmounts); - } - // 处理文件名 - List fileIdList = new ArrayList<>(); - BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); - BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); - if (!fileIdList.isEmpty()) { - List files = fileService.listByIds(fileIdList); - Map fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); - vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); - vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); - } - return vo; - } - - /** - * @param projectId 项目详情 不查询最新版本 - * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO - * @author ZPF - * @since 2023/02/11 11:15 - */ - public ProjectDetailVO getProjectDetailThisVersion(Long projectId) { - // 查询最新的项目申报信息 - Project projectInfo = projectService.getById(projectId); - if (Objects.isNull(projectInfo)) { - return null; - } - ProjectDetailVO vo = new ProjectDetailVO(); - BeanUtils.copyProperties(projectInfo, vo); - vo.buildDynamicForm(projectInfo.getDynamicForm()); - // 查询应用 - List applications = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) - .eq(ProjectApplication::getProjectCode, vo.getProjectCode()) - .eq(ProjectApplication::getIsConstruct, projectInfo.getIsConstruct()) - .eq(ProjectApplication::getProjectVersion, projectInfo.getVersion())); - - Optional.ofNullable(applications).ifPresent(apps -> - vo.setProjectApplications(CollUtils.convert(apps, - ProjectHelper::convertVO) - )); - - //审批信息 - ProcessDetailReq req = new ProcessDetailReq(); - req.setInstanceId(projectInfo.getInstCode()); - req.setProjectId(projectId); - vo.setProcess(todoService.getProcessDetail(req)); - - List allVersionProjectId = projectService.getAllVersionProjectId(projectInfo); - //查询采购备案 - List purchases = purchaseService.listByProjectId(projectId); - vo.setPurchases(BeanUtil.copyToList(purchases, PurchaseVO.class)); - - //查询合同备案 - Contract contract = contractService.getOne(Wrappers.lambdaQuery(Contract.class) - .in(Contract::getProjectId, allVersionProjectId) - .last(BizConst.LIMIT_1)); - ContractVO contractVO = BeanUtil.copyProperties(contract, ContractVO.class); - vo.setContract(contractVO); - List payments = paymentPlanService.list(Wrappers.lambdaQuery(PaymentPlan.class) - .in(PaymentPlan::getProjectId, allVersionProjectId) - .orderByAsc(PaymentPlan::getPaymentTime)); - if (Objects.nonNull(contractVO)) { - contractVO.setPayments(convertPayments(payments, - contractVO.getTotalAmount())); - } - - - //查询初验信息 - List acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) - .in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) - .orderByAsc(PreInsAcceptancePerson::getCreateOn)); - vo.setAcceptancePersons(convertPersons(acceptancePersons)); - - //查询终验信息 - //查询年度投资金额 要是已验收的项目 - if (ProjectStatusEnum.ACCEPTED.getCode().equals(projectInfo.getStatus())) { - List annualAmounts = Lists.newArrayList(); - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(projectInfo.getProjectYear()) - .annualAmount(projectInfo.getAnnualPlanAmount()) - .build()); - List renewalDeclarations = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) - .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getId()) - .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); - Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> - declarations.forEach(declaration -> { - annualAmounts.add(AnnualAmountVO.builder() - .projectId(projectInfo.getId()) - .projectYear(declaration.getProjectYear()) - .annualAmount(declaration.getAnnualPaymentAmount()) - .build()); - }) - ); - vo.setAnnualAccumulateAmountList(annualAmounts); - } - // 处理文件名 - List fileIdList = new ArrayList<>(); - BizUtils.notBlank(vo.getApprovedFile(), w -> fileIdList.add(Long.parseLong(w))); - BizUtils.notBlank(vo.getApprovedConstructionPlanFile(), w -> fileIdList.add(Long.parseLong(w))); - if (!fileIdList.isEmpty()) { - List files = fileService.listByIds(fileIdList); - Map fileMap = CollUtils.listToMap(files, w -> w.getId().toString(), File::getOriginalFileName); - vo.setApprovedFileName(fileMap.get(vo.getApprovedFile())); - vo.setApprovedConstructionPlanFileName(fileMap.get(vo.getApprovedConstructionPlanFile())); - } - return vo; - } - - /** * 获取项目初步方案详情 * * @param projectId @@ -1103,25 +1301,37 @@ public class ProjectLibManage { return res; } - private void saveApplication(Project project,Project oldProject,Boolean isConstruct) { + public void saveApplication(Project project,Project oldProject,Boolean isConstruct) { List apps = projectApplicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) .eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) .eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); if(CollUtil.isNotEmpty(apps)){ - apps = apps.stream().map(app -> { + apps.forEach(app -> { + Long oldAppId = app.getId(); app.setProjectVersion(project.getVersion()); app.setProjectId(project.getId()); app.setId(null); if(Objects.nonNull(isConstruct)){ app.setIsConstruct(isConstruct); } - return app; - }).collect(Collectors.toList()); - projectApplicationService.saveBatch(apps); + projectApplicationService.save(app); + + //核心业务 + List cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); + if(CollUtil.isNotEmpty(cores)){ + cores.forEach(c -> { + c.setId(null); + c.setApplicationId(app.getId()); + projectCoreBusinessIndicatorsService.save(c); + }); + } + }); } } private void saveApplication(ProjectDTO projectDto,Project project,Boolean isConstruct) { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); //保存项目应用 Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) ? Boolean.TRUE : Boolean.FALSE; @@ -1133,9 +1343,6 @@ public class ProjectLibManage { .eq(ProjectApplication::getProjectVersion, version)); if (CollUtil.isNotEmpty(applications)) { projectApplicationService.removeBatchByIds(applications); - List applicationIds = applications.stream().map(ProjectApplication::getId).collect(Collectors.toList()); - projectCoreBusinessIndicatorsService.remove(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) - .in(ProjectCoreBusinessIndicators::getApplicationId, applicationIds)); } if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { @@ -1150,7 +1357,6 @@ public class ProjectLibManage { projectApplication.setBuildOrgName(finalProject.getBuildOrgName()); projectApplication.setProjectVersion(version); projectApplication.setIsConstruct(isConstruct); - if(StringUtils.isNotBlank(application.getRelatedExistsApplication())){ projectApplication.setApplicationName(null); } @@ -1163,7 +1369,10 @@ public class ProjectLibManage { for (ProjectCoreBusinessDTO coreBusiness : coreBusinessList) { ProjectCoreBusinessIndicators projectCoreBusinessIndicators = new ProjectCoreBusinessIndicators(); BeanUtils.copyProperties(coreBusiness, projectCoreBusinessIndicators); - projectCoreBusinessIndicators.setApplicationId(application.getId()); + projectCoreBusinessIndicators.setId(null); + projectCoreBusinessIndicators.setApplicationId(projectApplication.getId()); + projectCoreBusinessIndicators.setCreateOn(LocalDateTime.now()); + projectCoreBusinessIndicators.setCreateBy(user.getUsername()); projectCoreBusinessIndicatorsService.save(projectCoreBusinessIndicators); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java index 2a3088a..6614ee9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java @@ -2,12 +2,15 @@ package com.ningdatech.pmapi.projectlib.manage; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcel; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; 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.basic.util.NdDateUtils; +import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; @@ -22,6 +25,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaratio import com.ningdatech.pmapi.projectlib.model.po.ProjectRenewalFundDeclarationPO; import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalAuditReq; import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq; +import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectRenewalFundDeclarationVO; import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; import com.ningdatech.pmapi.projectlib.service.IProjectService; @@ -37,6 +41,7 @@ import java.io.IOException; import java.time.LocalDateTime; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -99,6 +104,30 @@ public class ProjectRenewalFundManage { vo.setStage(project.getStage()); vo.setStatus(project.getStatus()); vo.setBuildOrgName(project.getBuildOrgName()); + vo.setAnnualPaymentAmount(renewal.getAnnualPaymentAmount()); + if (ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())) { + List annualAmounts = Lists.newArrayList(); + annualAmounts.add(AnnualAmountVO.builder() + .projectId(project.getId()) + .projectYear(project.getProjectYear()) + .annualAmount(project.getAnnualPlanAmount()) + .build()); + List renewalDeclarations = projectRenewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, vo.getProjectId()) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PASS.name()) + .eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) + .orderByAsc(ProjectRenewalFundDeclaration::getProjectYear)); + Optional.ofNullable(renewalDeclarations).ifPresent(declarations -> + declarations.forEach(declaration -> { + annualAmounts.add(AnnualAmountVO.builder() + .projectId(project.getId()) + .projectYear(declaration.getProjectYear()) + .annualAmount(declaration.getAnnualPaymentAmount()) + .build()); + }) + ); + vo.setAnnualAccumulateAmountList(annualAmounts); + } return vo; } @@ -121,11 +150,38 @@ public class ProjectRenewalFundManage { ProjectRenewalFundDeclaration oldDeclaration = projectRenewalFundDeclarationService.getById(dto.getId()); VUtils.isTrue(Objects.isNull(oldDeclaration)).throwMessage(String.format("重新申报失败 【%s】 该申报不存在!",dto.getId())); BeanUtils.copyProperties(oldDeclaration,declaration); + }else{ + declaration.setCreateOn(LocalDateTime.now()); + declaration.setUpdateOn(LocalDateTime.now()); } BeanUtils.copyProperties(dto,declaration); - declaration.setCreateOn(LocalDateTime.now()); - declaration.setUpdateOn(LocalDateTime.now()); + + //有2个条件要判断 续建资金 + //1. 如果有审核中的 是不能继续申请的 + long pendingCount = projectRenewalFundDeclarationService.count(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, projectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); + VUtils.isTrue(pendingCount > 0L).throwMessage("当前有在审核的续建项目 不能再申请了"); + + //2.是要当前最新资金的下年度 才能申请 + VUtils.isTrue(Objects.isNull(dto.getProjectYear())).throwMessage("新建的续建项目信息 年度不能为空"); + ProjectRenewalFundDeclaration lastRenewalFund = projectRenewalFundDeclarationService.getOne(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) + .eq(ProjectRenewalFundDeclaration::getProjectId, projectId) + .eq(ProjectRenewalFundDeclaration::getApprovalStatus,ProjectRenewalApprovalStatusEnum.PASS.name()) + .orderByDesc(ProjectRenewalFundDeclaration::getProjectYear) + .last(BizConst.LIMIT_1)); + //如果没有续建资金信息 就要比 当前项目的年度要大 + if(Objects.isNull(lastRenewalFund)){ + VUtils.isTrue(project.getProjectYear() >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + }else{ + VUtils.isTrue(lastRenewalFund.getProjectYear() >= dto.getProjectYear()) + .throwMessage("续建资金年度错误!"); + } + declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); + declaration.setRegionCode(project.getAreaCode()); + declaration.setOrgCode(project.getBuildOrgCode()); if(!projectRenewalFundDeclarationService.saveOrUpdate(declaration)){ throw new BusinessException(String.format("申报失败 【%s】",dto.getId())); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml index ef954f1..adb8e19 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/mapper/ProjectRenewalFundDeclarationMapper.xml @@ -26,8 +26,8 @@ and p.project_type = #{param.projectType} - - and p.project_year = #{param.projectYear} + + and prfd.project_year = #{param.year} and p.stage = #{param.stage} @@ -35,11 +35,15 @@ and p.status = #{param.status} - - and p.create_on >= #{param.createOnMin} + + and prfd.create_on >= #{param.startTime} - - and p.create_on <= #{param.createOnMax} + + and prfd.create_on <= #{param.endTime} + + and prfd.approval_status = #{param.approvalStatus} + + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java index fcb7571..cad1cb1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java @@ -325,6 +325,10 @@ public class Project implements Serializable { @Compare("建设周期(月)") private String buildCycle; + @ApiModelProperty("原始建设周期(月)") + @Compare("建设周期(月)") + private Integer originBuildCycle; + @ApiModelProperty("建设方案文件") @Compare("建设方案文件") private String constructionPlanFile; @@ -453,10 +457,15 @@ public class Project implements Serializable { @Compare("合同总金额") private BigDecimal contractAmount; - @ApiModelProperty("计划验收时间") - @Compare("计划验收时间") + @ApiModelProperty("计划验收时间(有可能是延期后的)") private LocalDateTime planAcceptanceTime; + @ApiModelProperty("原本计划验收时间") + private LocalDateTime originPlanAcceptanceTime; + + @ApiModelProperty("延期月份数") + private Integer applyDelayMonths; + @ApiModelProperty("申请延期佐证材料") private String applyDelayFile; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java index f7f0a39..7ef8ca7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectApplication.java @@ -187,4 +187,7 @@ public class ProjectApplication implements Serializable { @ApiModelProperty("是否为建设方案申报") private Boolean isConstruct; + + @ApiModelProperty("应用核心业务") + private Boolean coreBusinessList; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java index 7d9360c..58ad501 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/ProjectDelayApply.java @@ -54,4 +54,7 @@ public class ProjectDelayApply implements Serializable { @ApiModelProperty("延期申请实例ID") private String instanceId; + + @ApiModelProperty("是否审批成功") + private Boolean success; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java index 2dd6409..0cd3855 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java @@ -32,7 +32,7 @@ public class ProjectRenewalListReq extends PagePo { private Integer projectType; @ApiModelProperty("预算年度") - private Integer projectYear; + private Integer year; @ApiModelProperty("项目阶段") private Integer stage; @@ -42,11 +42,11 @@ public class ProjectRenewalListReq extends PagePo { @ApiModelProperty("创建时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMin; + private LocalDateTime startTime; @ApiModelProperty("创建时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") - private LocalDateTime createOnMax; + private LocalDateTime endTime; @ApiModelProperty("用户ID") private Long userId; @@ -59,4 +59,7 @@ public class ProjectRenewalListReq extends PagePo { @ApiModelProperty("项目状态 多个") private List statusList; + + @ApiModelProperty("审核状态") + private String approvalStatus; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java index 1aaa996..709544d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectApplicationVO.java @@ -1,11 +1,13 @@ package com.ningdatech.pmapi.projectlib.model.vo; +import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.List; /** *

@@ -177,8 +179,10 @@ public class ProjectApplicationVO implements Serializable { @ApiModelProperty("项目版本") private Integer projectVersion; + @ApiModelProperty("应用核心业务") + private List coreBusinessList; + private Long createBy; private Long updateBy; - } 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..87b6eee 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 @@ -2,14 +2,17 @@ package com.ningdatech.pmapi.projectlib.model.vo; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.pmapi.common.compare.Compare; import com.ningdatech.pmapi.common.util.BizUtils; -import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; +import com.ningdatech.pmapi.portrait.model.vo.TagVO; 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; @@ -17,7 +20,6 @@ import lombok.Data; import org.apache.commons.lang3.StringUtils; import java.math.BigDecimal; -import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -374,6 +376,9 @@ public class ProjectDetailVO { @ApiModelProperty("初审人员") private List acceptancePersons; + @ApiModelProperty("实施信息") + private OperationVO operation; + @ApiModelProperty("版本号str") private String versionStr; @@ -395,9 +400,27 @@ public class ProjectDetailVO { @ApiModelProperty("审批详情") private ProcessProgressDetailVo process; + @ApiModelProperty("标签") + private List tags; + @ApiModelProperty("是否退回|驳回的项目版本") private Boolean isBackReject; + @ApiModelProperty("原本计划验收时间") + @Compare("原本计划验收时间") + private LocalDateTime originPlanAcceptanceTime; + + @ApiModelProperty("延期月份数") + private Integer applyDelayMonths; + + @ApiModelProperty("原始建设周期(月)") + @Compare("建设周期(月)") + private Integer originBuildCycle; + + @ApiModelProperty("计划验收时间(有可能是延期后的)") + @Compare("计划验收时间") + private LocalDateTime planAcceptanceTime; + public String getVersionStr() { if (Objects.nonNull(this.newest) && this.newest) { this.versionStr = "当前版本"; @@ -421,4 +444,27 @@ 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..b0997d2 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,8 +3,10 @@ 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.projectlib.model.entity.ProjectRenewalFundDeclaration; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import io.swagger.annotations.ApiModel; @@ -16,6 +18,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,8 +151,15 @@ public class ProjectLibListItemVO { @ApiModelProperty("初步方案项目ID") private Long prePlanProjectId; + @ApiModelProperty("标签") + private List tags; + //预审申报时候 需不需要上传上级条线意见文件 private Boolean needUploadSuperLineFile; + + @ApiModelProperty("年度投资金额总额") + private BigDecimal annualAccumulateAmount; + private List annualAccumulateAmountList; public Boolean getNeedUploadSuperLineFile() { UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); //要满足条件 1.当前登录人是市本级单位 2.有上级条线单位 3.项目状态是待预审 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java index 210d717..c530fe0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectRenewalFundDeclarationVO.java @@ -7,6 +7,7 @@ import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** *

@@ -84,4 +85,10 @@ public class ProjectRenewalFundDeclarationVO implements Serializable { @ApiModelProperty("项目类型 1建设 2运维") private Integer projectType; + + @ApiModelProperty("审核意见") + private String auditOpinion; + + @ApiModelProperty("年度投资金额详情") + private List annualAccumulateAmountList; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectApplicationService.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectApplicationService.java index a29ec65..1c52dd5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectApplicationService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/IProjectApplicationService.java @@ -17,4 +17,6 @@ import java.util.List; public interface IProjectApplicationService extends IService { List getApplicationsByProject(Project project); + + void saveApplication(Project project,Project oldProject,Boolean isConstruct); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectApplicationServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectApplicationServiceImpl.java index 4f17811..16f41f3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectApplicationServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectApplicationServiceImpl.java @@ -1,14 +1,20 @@ package com.ningdatech.pmapi.projectlib.service.impl; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; +import com.ningdatech.pmapi.performance.service.IProjectCoreBusinessIndicatorsService; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.mapper.ProjectApplicationMapper; import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Objects; /** *

@@ -19,7 +25,12 @@ import java.util.List; * @since 2023-02-05 */ @Service -public class ProjectApplicationServiceImpl extends ServiceImpl implements IProjectApplicationService { +@Slf4j +@AllArgsConstructor +public class ProjectApplicationServiceImpl extends ServiceImpl + implements IProjectApplicationService { + + private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; @Override public List getApplicationsByProject(Project project) { @@ -27,4 +38,34 @@ public class ProjectApplicationServiceImpl extends ServiceImpl apps = list(Wrappers.lambdaQuery(ProjectApplication.class) + .eq(ProjectApplication::getProjectCode, oldProject.getProjectCode()) + .eq(ProjectApplication::getProjectVersion, oldProject.getVersion())); + if(CollUtil.isNotEmpty(apps)){ + apps.forEach(app -> { + Long oldAppId = app.getId(); + app.setProjectVersion(project.getVersion()); + app.setProjectId(project.getId()); + app.setId(null); + if(Objects.nonNull(isConstruct)){ + app.setIsConstruct(isConstruct); + } + save(app); + + //核心业务 + List cores = projectCoreBusinessIndicatorsService.list(Wrappers.lambdaQuery(ProjectCoreBusinessIndicators.class) + .eq(ProjectCoreBusinessIndicators::getApplicationId, oldAppId)); + if(CollUtil.isNotEmpty(cores)){ + cores.forEach(c -> { + c.setId(null); + c.setApplicationId(app.getId()); + projectCoreBusinessIndicatorsService.save(c); + }); + } + }); + } + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectServiceImpl.java index 4530ea2..6213cc1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/service/impl/ProjectServiceImpl.java @@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.performance.model.entity.ProjectCoreBusinessIndicators; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.mapper.ProjectMapper; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java index a1deded..1cef45c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java @@ -50,7 +50,7 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc @Autowired private RestTemplate restTemplate; - @Resource(name = "refreshToken") + @Resource private IRefreshTokenService refreshTokenService; @Value("${irs.interface-refresh.request-token-url}") 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..e1f9b6f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java @@ -0,0 +1,224 @@ +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.common.constant.RegionConst; +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()) + .eq(StringUtils.isNotBlank(req.getRegionCode()),Project::getAreaCode,req.getRegionCode()) + .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() + "项目"); + if(!RegionConst.RC_LS.equals(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..7d79ccd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/listener/EarlyWarningListener.java @@ -0,0 +1,114 @@ +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.enumeration.CommonEnum; +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.manage.EarlyWarningManage; +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.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 EarlyWarningManage earlyWarningManage; + + @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; + } + + if(StringUtils.isBlank(noticeMethod) || + (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + log.info("通知方式为空或者错误!"); + return; + } + + for(HistoricActivityInstance hai : hais){ + String employeeCode = hai.getAssignee(); + earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,pi.getInstType(), + hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() + ,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode()); + } + } +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java new file mode 100644 index 0000000..292cee1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java @@ -0,0 +1,288 @@ +package com.ningdatech.pmapi.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.common.enumeration.CommonEnum; +import com.ningdatech.pmapi.projectdeclared.model.entity.Contract; +import com.ningdatech.pmapi.projectdeclared.model.entity.Operation; +import com.ningdatech.pmapi.projectdeclared.service.IContractService; +import com.ningdatech.pmapi.projectdeclared.service.IOperationService; +import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; +import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; +import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.sys.manage.EarlyWarningManage; +import com.wflow.bean.entity.WflowEarlyWarning; +import com.wflow.enums.WarningRuleTypeEnum; +import com.wflow.service.IEarlyWarningService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.*; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * @author ZPF + * @date 2023/8/3 上午9:53 + * 预警填报 超时任务 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class EarlyWarningInstanceNotStartTask { + + @Value("${hostname}") + private String HOST_NAME; + + private final IEarlyWarningService earlyWarningService; + + private final IProjectService projectService; + + private final EarlyWarningManage earlyWarningManage; + + private final IContractService contractService; + + private final IOperationService operationService; + + @Scheduled(cron = "0 0/2 * * * ?") + public void doEarlyWarningDeclared() throws UnknownHostException { + if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + return; + } + + log.info("=========== 预警填报超时任务开始 ========"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + // 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 + List warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) + .eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.DECLARED_WARNING.getCode())); + for(WflowEarlyWarning warning : warnings){ + //2. 取出rule的数据 + if(!warning.getIsOpen()){ + log.info(warning.getId() + " 此规则关闭了"); + continue; + } + + String noticeMethod = warning.getNoticeMethod(); + if(StringUtils.isBlank(noticeMethod) || + (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + log.info("通知方式为空或者错误!"); + return; + } + + String noticeContent = warning.getNoticeContent(); + String rule = warning.getRule(); + if(StringUtils.isNotBlank(rule)){ + JSONArray ruleArray = JSON.parseArray(rule); + if(CollUtil.isNotEmpty(ruleArray)){ + ruleArray.forEach(r -> { + JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); + Integer time = rJson.getInteger("time"); + Integer biz = rJson.getInteger("biz"); + if(Objects.isNull(time) || Objects.isNull(biz)){ + log.info("规则数据 错误 :{}",rJson); + return; + } + + WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); + if(Objects.isNull(flowTypeEnum)){ + log.info("匹配不到 业务类型"); + return; + } + + //得出 对应待提交的项目状态 + Integer projectStutas = flowTypeEnum.getProjectStutas(); + String areaCode = warning.getAreaCode(); + //测试先用分钟 + //查询 所有这个区域的项目 未提交的项目 + List needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getAreaCode, areaCode) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getStatus,projectStutas)); + + //需要发通知的项目 + List needToWaringProjects = needNextProjects.stream() + .filter(p -> { + //判断 当状态在 建设中的时候 是不是要初验了 + if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ + List allVersionProjectId = projectService.getAllVersionProjectId(p); + //如果合同信息提交过了 才是 待初验状态 + if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ + if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) + .in(Contract::getProjectId, allVersionProjectId))){ + return Boolean.FALSE; + } + } + } + + if(Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + return Boolean.TRUE; + } + return Boolean.FALSE; + }) + .collect(Collectors.toList()); + + if(StringUtils.isBlank(noticeMethod) || + (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + log.info("通知方式为空或者错误!"); + return; + } + + for(Project needToWaringProject : needToWaringProjects){ + //去预警通知 + String employeeCode = needToWaringProject.getSponsor(); + earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,biz, + needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, + WarningRuleTypeEnum.DECLARED_WARNING.getCode()); + } + }); + } + } + } + + stopWatch.stop(); + log.info("=========== 预警填报超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + } + + @Scheduled(cron = "10 0/2 * * * ?") + public void doEarlyWarningOperation() throws UnknownHostException { + if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { + return; + } + + log.info("=========== 预警实施超时任务开始 ========"); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + // 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 + List warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) + .eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode())); + for(WflowEarlyWarning warning : warnings){ + //2. 取出rule的数据 + if(!warning.getIsOpen()){ + log.info(warning.getId() + " 此规则关闭了"); + continue; + } + + String noticeMethod = warning.getNoticeMethod(); + if(StringUtils.isBlank(noticeMethod) || + (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + log.info("通知方式为空或者错误!"); + return; + } + + String noticeContent = warning.getNoticeContent(); + String rule = warning.getRule(); + if(StringUtils.isNotBlank(rule)){ + JSONArray ruleArray = JSON.parseArray(rule); + if(CollUtil.isNotEmpty(ruleArray)){ + ruleArray.forEach(r -> { + JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); + Integer time = rJson.getInteger("time"); + Integer biz = rJson.getInteger("biz"); + if(Objects.isNull(time) || Objects.isNull(biz)){ + log.info("规则数据 错误 :{}",rJson); + return; + } + + WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); + if(Objects.isNull(operationTypeEnum)){ + log.info("匹配不到 业务类型"); + return; + } + + //得出 对应待提交的项目状态 + Integer projectStutas = operationTypeEnum.getProjectStutas(); + String areaCode = warning.getAreaCode(); + //测试先用分钟 + //查询 所有这个区域的项目 未提交的项目 + List needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) + .eq(Project::getAreaCode, areaCode) + .eq(Project::getNewest, Boolean.TRUE) + .eq(Project::getStatus,projectStutas)); + + List projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); + + List operations = operationService.list(Wrappers.lambdaQuery(Operation.class) + .in(Operation::getProjectCode, projectCodes)); + + Map operationMap = operations.stream().collect(Collectors.toMap(Operation::getProjectCode,o -> o)); + //需要发通知的项目 + List needToWaringProjects = needNextProjects.stream() + .filter(p -> { + //判断 当状态在 建设中的时候 是不是要初验了 + if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ + List allVersionProjectId = projectService.getAllVersionProjectId(p); + //如果合同信息提交过了 才是 待初验状态 + if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ + if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) + .in(Contract::getProjectId, allVersionProjectId))){ + return Boolean.FALSE; + } + } + } + + //判断 实施信息中 初验和终验的时间 + if(!operationMap.containsKey(p.getProjectCode())){ + return Boolean.FALSE; + } + Operation operation = operationMap.get(p.getProjectCode()); + if(WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)){ + //初验 + if(Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + return Boolean.TRUE; + } + }else if(WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)){ + //终验 + if(Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 + Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 + return Boolean.TRUE; + } + } + + return Boolean.FALSE; + }) + .collect(Collectors.toList()); + + if(StringUtils.isBlank(noticeMethod) || + (!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && + !noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ + log.info("通知方式为空或者错误!"); + return; + } + + for(Project needToWaringProject : needToWaringProjects){ + //去预警通知 + String employeeCode = needToWaringProject.getSponsor(); + earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,time,biz, + needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, + WarningRuleTypeEnum.OPERATION_WARNING.getCode()); + } + }); + } + } + } + + stopWatch.stop(); + log.info("=========== 预警实施超时任务结束 耗时{}s", stopWatch.getTotalTimeSeconds()); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/contants/UserGuidanceContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/contants/UserGuidanceContant.java new file mode 100644 index 0000000..7cd5fa4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/contants/UserGuidanceContant.java @@ -0,0 +1,33 @@ +package com.ningdatech.pmapi.sys.contants; + +/** + * @Classname UserGuidanceContant + * @Description + * @Date 2023/8/8 14:56 + * @Author PoffyZhang + */ +public interface UserGuidanceContant { + + Integer ALL_FINISHED_NUM = 3; + + class OrgModel { + public static final String GUIDANCE_NAME = "配置单位流程"; + public static final String GUIDANCE_REMARK = "用户项目审核,请先配置单位默认流程"; + public static final String GUIDANCE_PATH1 = "unitSet/flowPathConfiguration"; + public static final String GUIDANCE_PATH2 = "unitSet/unitConfigEdit?processDefId="; + + public static final String EMPTY_PROCESS = "{}"; + } + + class FiscalCode { + public static final String GUIDANCE_NAME = "配置财政编码"; + public static final String GUIDANCE_REMARK = "用于生成项目唯一编码"; + public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; + } + + class Signature { + public static final String GUIDANCE_NAME = "配置印章编码"; + public static final String GUIDANCE_REMARK = "用于电子签章"; + public static final String GUIDANCE_PATH = "unitSet/fiscalCodeSet"; + } +} 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/controller/UserGuidanceController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/UserGuidanceController.java new file mode 100644 index 0000000..dff983d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/UserGuidanceController.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.sys.controller; + +import com.ningdatech.pmapi.sys.manage.UserGuidanceManage; +import com.ningdatech.pmapi.sys.model.vo.UserGuidanceVO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +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.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Classname UserGuidanceController + * @Description + * @Date 2023/8/8 13:46 + * @Author PoffyZhang + */ +@Slf4j +@Validated +@RestController +@RequestMapping("/api/v1/sys/user-guidanc") +@Api(value = "UserGuidance", tags = "用户引导") +@RequiredArgsConstructor +public class UserGuidanceController { + + private final UserGuidanceManage userGuidanceManage; + + @ApiOperation(value = "获取当前用户单位的一些配置是否完成", notes = "获取当前用户单位的一些配置是否完成") + @GetMapping("/detail") + public UserGuidanceVO detail() { + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + return userGuidanceManage.detailUserGuidance(user); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java new file mode 100644 index 0000000..674da96 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/EarlyWarningManage.java @@ -0,0 +1,157 @@ +package com.ningdatech.pmapi.sys.manage; + +import com.ningdatech.pmapi.common.enumeration.CommonEnum; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; +import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; +import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; +import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; +import com.ningdatech.pmapi.sys.model.entity.Notify; +import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; +import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; +import com.ningdatech.pmapi.sys.service.INotifyService; +import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.yxt.model.cmd.SendSmsCmd; +import com.wflow.enums.WarningRuleTypeEnum; +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.Objects; + +/** + * @Classname EarlyWarningManage + * @Description + * @Date 2023/8/7 9:25 + * @Author PoffyZhang + */ +@Component +@AllArgsConstructor +@Slf4j +public class EarlyWarningManage { + + private final UserInfoHelper userInfoHelper; + + private final NoticeManage noticeManage; + + private final IEarlyWarningRecordsService earlyWarningRecordsService; + + private final YxtCallOrSmsHelper yxtCallOrSmsHelper; + + private final INdWorkNoticeStagingService workNoticeStagingService; + + private final INotifyService notifyService; + + /** + * 预警通知 + * @param noticeMethod + * @param noticeContent + * @param timeout + * @param employeeCode + * @param project + */ + public void doEarlyWarning(String noticeMethod,String noticeContent, Integer timeout,Integer biz, + LocalDateTime startTime,String employeeCode, Project project,Integer ruleType) { + //1.存入 预警记录 + UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); + WflowEarlyWarningRecords records = new WflowEarlyWarningRecords(); + String content = StringUtils.EMPTY; + + switch (WarningRuleTypeEnum.checkByCode(ruleType)){ + case PROCESS_WARNING: + content = convertContent(noticeContent,project.getProjectName(), + InstTypeEnum.getByCode(biz),timeout); + records.setRuleType(WarningRuleTypeEnum.PROCESS_WARNING.getCode()); + break; + case DECLARED_WARNING: + content = convertContent(noticeContent,project.getProjectName(), + WarningFlowTypeEnum.getByCode(biz),timeout); + records.setRuleType(WarningRuleTypeEnum.DECLARED_WARNING.getCode()); + break; + case OPERATION_WARNING: + content = convertContent(noticeContent,project.getProjectName(), + WarningOperationTypeEnum.getByCode(biz),timeout); + records.setRuleType(WarningRuleTypeEnum.OPERATION_WARNING.getCode()); + break; + default: + log.info("匹配不到 规则类型"); + return; + } + + records.setAreaCode(project.getAreaCode()); + records.setBuildOrgCode(project.getBuildOrgCode()); + records.setBuildOrgName(project.getBuildOrgName()); + records.setCreateOn(LocalDateTime.now()); + records.setWarningTime(LocalDateTime.now()); + records.setInstStart(startTime); + records.setInstType(biz); + records.setNoticeMethod(noticeMethod); + records.setNoticeContent(content); + records.setProjectName(project.getProjectName()); + records.setWarningUsername(Objects.nonNull(user) ? user.getUsername() : StringUtils.EMPTY); + records.setWarningEmployeecode(employeeCode); + earlyWarningRecordsService.save(records); + + //2.消息提醒 + Notify notify = noticeManage.assemblyAuditNotify(user.getUserId(), project, content); + notify.setType(MsgTypeEnum.PROJECT_REVIEW.name()); + notifyService.save(notify); + + //3.发短信 + if(noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode()))){ + SendSmsCmd.SendSmsContext context = new SendSmsCmd.SendSmsContext(); + context.setReceiveNumber(user.getMobile()); + context.setContent(content); + yxtCallOrSmsHelper.sendSms(context); + } + + //4.浙政钉 + if(noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))){ + // 获取发送浙政钉工作通知必要信息 + WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(employeeCode); + passWorkNoticeInfo.setMsg(content); + // 放入工作通知暂存表中,通过扫表异步发送 + workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); + } + } + + /** + * 转换出 通知的内容 + * @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("{stepName}",Objects.nonNull(instTypeEnum) ? instTypeEnum.getDesc() : "{stepName}") + .replace("{time}",String.valueOf(timeout)); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } + + private String convertContent(String noticeContent, String projectName, WarningFlowTypeEnum warningFlowTypeEnum, Integer timeout) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{flowType}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}",Objects.nonNull(warningFlowTypeEnum) ? warningFlowTypeEnum.getDesc() : "{stepName}") + .replace("{time}",String.valueOf(timeout)); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } + + private String convertContent(String noticeContent, String projectName, WarningOperationTypeEnum operationTypeEnum, Integer timeout) { + noticeContent = noticeContent.replace("{projectName}",projectName) + .replace("{flowType}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{flowType}") + .replace("{stepName}",Objects.nonNull(operationTypeEnum) ? operationTypeEnum.getDesc() : "{stepName}") + .replace("{time}",String.valueOf(timeout)); + log.info("通知内容 :{}",noticeContent); + return noticeContent; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index a5ff193..b08a020 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -237,7 +237,7 @@ public class NoticeManage { * @param project * @param msg */ - private Notify assemblyAuditNotify(Long userId, Project project, String msg) { + public Notify assemblyAuditNotify(Long userId, Project project, String msg) { Notify notify = new Notify(); notify.setTitle(AUDIT_WORK_TITLE); notify.setUserId(userId); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/UserGuidanceManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/UserGuidanceManage.java new file mode 100644 index 0000000..29dcc74 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/UserGuidanceManage.java @@ -0,0 +1,134 @@ +package com.ningdatech.pmapi.sys.manage; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; +import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService; +import com.ningdatech.pmapi.signature.entity.CompanySignature; +import com.ningdatech.pmapi.signature.service.ICompanySignatureService; +import com.ningdatech.pmapi.sys.contants.UserGuidanceContant; +import com.ningdatech.pmapi.sys.model.vo.UserGuidanceDetailVO; +import com.ningdatech.pmapi.sys.model.vo.UserGuidanceVO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.wflow.bean.entity.WflowOrgModels; +import com.wflow.enums.ProcessDefTypeEnum; +import com.wflow.service.OrgProcdefService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Objects; + +/** + * @Classname UserGuidanceManage + * @Description + * @Date 2023/8/8 13:49 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class UserGuidanceManage { + + private final OrgProcdefService orgProcdefService; + + private final ICompanyFiscalCodeService fiscalCodeService; + + private final ICompanySignatureService signatureService; + + /** + * 查询用户引导 详情 + * @param user + * @return + */ + public UserGuidanceVO detailUserGuidance(UserInfoDetails user) { + UserGuidanceVO vo = new UserGuidanceVO(); + //单位code + String empPosUnitCode = user.getEmpPosUnitCode(); + vo.setEmpPosUnitCode(empPosUnitCode); + //用户信息 + String username = user.getUsername(); + vo.setUsername(username); + Long userId = user.getUserId(); + vo.setUserId(userId); + + //查询引导详情 + List details = Lists.newArrayList(); + UserGuidanceDetailVO orgModelGuidance = new UserGuidanceDetailVO(); + orgModelGuidance.setName(UserGuidanceContant.OrgModel.GUIDANCE_NAME); + orgModelGuidance.setRemark(UserGuidanceContant.OrgModel.GUIDANCE_REMARK); + + Integer finishedNum = 0; + //1.去查询 用户所在单位 有没有单位默认流程配置 并且process 不能为空 + WflowOrgModels orgModel = orgProcdefService.getOne(Wrappers.lambdaQuery(WflowOrgModels.class) + .eq(WflowOrgModels::getOrgCode, empPosUnitCode) + .eq(WflowOrgModels::getType, ProcessDefTypeEnum.DEFAULT.name()) + .eq(WflowOrgModels::getIsDelete, Boolean.FALSE) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(orgModel)){ + orgModelGuidance.setPath(UserGuidanceContant.OrgModel.GUIDANCE_PATH1); + orgModelGuidance.setIsFinish(Boolean.FALSE); + }else{ + orgModelGuidance.setPath(UserGuidanceContant.OrgModel.GUIDANCE_PATH2 + orgModel.getProcessDefId()); + //判断process是否为空 + if(StringUtils.isNotBlank(orgModel.getProcess()) && + !UserGuidanceContant.OrgModel.EMPTY_PROCESS.equals(orgModel.getProcess())){ + orgModelGuidance.setIsFinish(Boolean.TRUE); + finishedNum ++; + }else{ + orgModelGuidance.setIsFinish(Boolean.FALSE); + } + } + details.add(orgModelGuidance); + + //2.去查询 财政编码 印章编码 + UserGuidanceDetailVO fiscalCodeGuidance = new UserGuidanceDetailVO(); + fiscalCodeGuidance.setName(UserGuidanceContant.FiscalCode.GUIDANCE_NAME); + fiscalCodeGuidance.setRemark(UserGuidanceContant.FiscalCode.GUIDANCE_REMARK); + fiscalCodeGuidance.setPath(UserGuidanceContant.FiscalCode.GUIDANCE_PATH); + CompanyFiscalCode fiscalCode = fiscalCodeService.getOne(Wrappers.lambdaQuery(CompanyFiscalCode.class) + .eq(CompanyFiscalCode::getOrganizationCode, empPosUnitCode) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(fiscalCode)){ + fiscalCodeGuidance.setIsFinish(Boolean.FALSE); + }else{ + //判断fiscalCode是否为空 + if(StringUtils.isNotBlank(fiscalCode.getFiscalCode())){ + fiscalCodeGuidance.setIsFinish(Boolean.TRUE); + finishedNum ++; + }else{ + fiscalCodeGuidance.setIsFinish(Boolean.FALSE); + } + } + details.add(fiscalCodeGuidance); + + UserGuidanceDetailVO signatureGuidance = new UserGuidanceDetailVO(); + signatureGuidance.setName(UserGuidanceContant.Signature.GUIDANCE_NAME); + signatureGuidance.setRemark(UserGuidanceContant.Signature.GUIDANCE_REMARK); + signatureGuidance.setPath(UserGuidanceContant.Signature.GUIDANCE_PATH); + CompanySignature signature = signatureService.getOne(Wrappers.lambdaQuery(CompanySignature.class) + .eq(CompanySignature::getOrganizationCode, empPosUnitCode) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(signature)){ + signatureGuidance.setIsFinish(Boolean.FALSE); + }else{ + //判断印章编码是否为空 + if(StringUtils.isNotBlank(signature.getSealSn())){ + signatureGuidance.setIsFinish(Boolean.TRUE); + finishedNum ++; + }else{ + signatureGuidance.setIsFinish(Boolean.FALSE); + } + } + details.add(signatureGuidance); + + if(UserGuidanceContant.ALL_FINISHED_NUM.equals(finishedNum)){ + vo.setIsAllFinished(Boolean.TRUE); + } + vo.setDetails(details); + return vo; + } +} 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..7613b7c --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/WarningListReq.java @@ -0,0 +1,41 @@ +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 org.springframework.format.annotation.DateTimeFormat; + +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("提醒开始时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @ApiModelProperty("提醒结束时间") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + + @ApiModelProperty("区域Code") + private String areaCode; +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceDetailVO.java new file mode 100644 index 0000000..f4819d1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceDetailVO.java @@ -0,0 +1,46 @@ +package com.ningdatech.pmapi.sys.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; +import lombok.experimental.Accessors; + +/** + * @Classname UserGuidanceDetailVO + * @Description + * @Date 2023/8/8 14:24 + * @Author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "UserGuidanceDetailVO", description = "用户引导详情VO") +public class UserGuidanceDetailVO { + + /** + * 页面路径 + */ + @ApiModelProperty(value = "页面路径") + private String path; + + /** + * 是否完成 + */ + @ApiModelProperty(value = "是否完成") + private Boolean isFinish; + + /** + * 事项名称 + */ + @ApiModelProperty(value = "事项名称") + private String name; + + /** + * 备注 描述 + */ + @ApiModelProperty(value = "备注 描述") + private String remark; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceVO.java new file mode 100644 index 0000000..da3ff89 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/UserGuidanceVO.java @@ -0,0 +1,51 @@ +package com.ningdatech.pmapi.sys.model.vo; + +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.util.List; + +/** + * @Classname UserGuidanceVO + * @Description + * @Date 2023/8/8 14:24 + * @Author PoffyZhang + */ +@Data +@NoArgsConstructor +@ToString(callSuper = true) +@Accessors(chain = true) +@ApiModel(value = "UserGuidanceVO", description = "用户引导VO") +public class UserGuidanceVO { + + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID") + private Long userId; + + /** + * 用户名 + */ + @ApiModelProperty(value = "用户名") + private String username; + + /** + * 单位code + */ + @ApiModelProperty(value = "单位code") + private String empPosUnitCode; + + /** + * 是否全部完成 + */ + @ApiModelProperty(value = "是否全部完成") + private Boolean isAllFinished = Boolean.FALSE; + + @ApiModelProperty(value = "详情") + private List details; +} 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..540951a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/WflowEarlyWarningRecordsVO.java @@ -0,0 +1,142 @@ +package com.ningdatech.pmapi.sys.model.vo; + +import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; +import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum; +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) && Objects.nonNull(this.ruleType)){ + if(this.ruleType.equals(WarningRuleTypeEnum.PROCESS_WARNING.getCode())){ + InstTypeEnum instEnum = InstTypeEnum.getByCode(this.instType); + if(Objects.nonNull(instEnum)){ + return instEnum.getDesc(); + } + }else if(this.ruleType.equals(WarningRuleTypeEnum.DECLARED_WARNING.getCode())){ + WarningFlowTypeEnum warningFlowTypeEnum = WarningFlowTypeEnum.getByCode(this.instType); + if(Objects.nonNull(warningFlowTypeEnum)){ + return warningFlowTypeEnum.getDesc(); + } + }else if(this.ruleType.equals(WarningRuleTypeEnum.OPERATION_WARNING.getCode())){ + WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(this.instType); + if(Objects.nonNull(operationTypeEnum)){ + return operationTypeEnum.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..f3e6c03 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/EarlyWarningRecordsServiceImpl.java @@ -0,0 +1,62 @@ +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) + .eq(StringUtils.isNotBlank(req.getAreaCode()),WflowEarlyWarningRecords::getAreaCode,req.getAreaCode()) + .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/todocenter/manage/HandlerManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java index 3cac81b..62754c6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java @@ -243,6 +243,9 @@ public class HandlerManage { ProjectDelayApply delayApply = projectDelayApplyService.getOne(Wrappers.lambdaQuery(ProjectDelayApply.class) .eq(ProjectDelayApply::getProjectId, declaredProject.getId()) .eq(ProjectDelayApply::getInstanceId, instanceId)); + delayApply.setSuccess(Boolean.TRUE); + delayApply.setUpdateOn(LocalDateTime.now()); + projectDelayApplyService.updateById(delayApply); // 获取项目的立项批复时间和建设周期 LocalDateTime approvalDate = declaredProject.getApprovalDate(); String buildCycle = declaredProject.getBuildCycle(); @@ -256,6 +259,9 @@ public class HandlerManage { declaredProject.setInstCode(instanceId); declaredProject.setApplyDelayFile(delayApply.getDelayApplyFile()); declaredProject.setApplyDelayReason(delayApply.getDelayApplyReason()); + //增加总延期的月份 + declaredProject.setApplyDelayMonths(Objects.nonNull(declaredProject.getApplyDelayMonths()) ? + declaredProject.getApplyDelayMonths() + delayApply.getDelayTime() : delayApply.getDelayTime()); projectService.updateById(declaredProject); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 9b91443..c6ed2f8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -29,8 +29,6 @@ import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.irs.sign.IRSAPIRequest; -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.projectdeclared.manage.DefaultDeclaredProjectManage; import com.ningdatech.pmapi.projectlib.enumeration.*; @@ -103,7 +101,6 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import sun.misc.BASE64Decoder; - import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -143,9 +140,7 @@ public class TodoCenterManage { private final PassHandle passHandle; private final RepositoryService repositoryService; private final IRegionService regionService; - private final ITodoService todoService; - private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; /** * 待办中心待我处理项目列表查询 @@ -653,7 +648,10 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + Map projectInfoMap = projectInstList.stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && + !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 @@ -724,7 +722,10 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + projectInfoMap = projectInstList.stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && + !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 @@ -793,7 +794,10 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + Map projectInfoMap = projectInstList.stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && + !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 @@ -862,7 +866,10 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + projectInfoMap = projectInstList.stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && + !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 @@ -932,7 +939,10 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - Map projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + Map projectInfoMap = projectInstList.stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && + !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 查出用户工作流 @@ -1002,7 +1012,10 @@ public class TodoCenterManage { List projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) .in(ProjectInst::getProjectId, projectIdList) .orderByDesc(ProjectInst::getProjectId)); - projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); + projectInfoMap = projectInstList.stream() + .filter(p -> StringUtils.isNotBlank(p.getInstCode()) && + !TodoCenterConstant.Declared.NULL_INST_CODE.equals(p.getInstCode())) + .collect(Collectors.toMap(ProjectInst::getInstCode, p -> projectsMap.get(p.getProjectId()))); List instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList()); // 分页查出用户工作流 @@ -1110,7 +1123,7 @@ public class TodoCenterManage { .eq(ProjectInst::getInstCode, oldProject.getInstCode())); String instCode = oldProject.getInstCode(); - oldInst.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); + oldInst.setInstCode("EMPTY"); projectInstService.updateById(oldInst); ProjectInst newPi = new ProjectInst(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java index 64b3317..a597584 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/TodoServiceImpl.java @@ -60,6 +60,7 @@ public class TodoServiceImpl implements ITodoService { * @param request 请求参数 * @return 流程进度及表单详情 */ + @Override public ProcessProgressDetailVo getProcessDetail(ProcessDetailReq request) { String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); String instanceId = request.getInstanceId(); @@ -137,6 +138,7 @@ public class TodoServiceImpl implements ITodoService { * @param projectId * @return */ + @Override public Boolean isChangeRecord(Long projectId) { //1.先判断下 项目存不存在 Project project = projectService.getById(projectId); @@ -154,7 +156,11 @@ public class TodoServiceImpl implements ITodoService { if(CollUtil.isEmpty(pis)){ return Boolean.FALSE; } + //判断 项目关联的最新的2个实例 如果类型不匹配 也不属于是变更了 + //还要看 项目当前的流程实例code 是不是 关联的最新实例 if( pis.size() < 2 || + !pis.get(0).getInstCode().equals(project.getInstCode()) || + pis.get(0).getProjectId().equals(pis.get(1).getProjectId()) || !pis.get(0).getInstType().equals(pis.get(1).getInstType())) { return Boolean.FALSE; } 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 c237caa..792d364 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 @@ -160,6 +160,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)) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/wps/contants/WpsContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/wps/contants/WpsContant.java new file mode 100644 index 0000000..ad581dd --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/wps/contants/WpsContant.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.wps.contants; + +/** + * @Classname WpsContant + * @Description + * @Date 2023/8/15 14:09 + * @Author PoffyZhang + */ +public interface WpsContant { + + String WPS_CONVERT_URL_ONLINE = "http://10.53.157.47"; + String FIX_FILE_PATH = "/opt/file/"; + String PDF_PATH = "/opt/file/offices2pdf.pdf"; + String PDF_CONTENT_TYPE = "application/pdf"; + String PDF_NAME = "offices2pdf.pdf"; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/wps/controller/WpsConvertController.java b/pmapi/src/main/java/com/ningdatech/pmapi/wps/controller/WpsConvertController.java new file mode 100644 index 0000000..c229757 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/wps/controller/WpsConvertController.java @@ -0,0 +1,82 @@ +package com.ningdatech.pmapi.wps.controller; + +import com.ningdatech.irs.service.IRefreshTokenService; +import com.ningdatech.pmapi.common.util.CryptUtils; +import com.ningdatech.pmapi.common.util.HttpUtil; +import com.ningdatech.pmapi.wps.manage.WpsConvertManage; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +import javax.servlet.http.HttpServletResponse; +import java.security.NoSuchAlgorithmException; +import java.util.Objects; + +/** + * @Classname WpsConvertController + * @Description + * @Date 2023/8/14 13:58 + * @Author PoffyZhang + */ +@Slf4j +@RestController +@Api(tags = "待办中心控制器") +@RequestMapping("/api/v1/wps-convert") +public class WpsConvertController { + @Autowired + private IRefreshTokenService refreshTokenService; + + @Autowired + private WpsConvertManage wpsConvertManage; + + + @Value("${irs.interface-refresh.request-token-url}") + private String govRequestTokenUrl; + @Value("${irs.interface-refresh.refresh-token-url}") + private String govRefreshTokenUrl; + + @GetMapping("/office2pdf") + public String office2pdf(){ + return wpsConvertManage.offs2Pdf(); + } + + @GetMapping("/downloadToPdfStream") + public void downloadToPdfStream(@RequestParam Long fileId, HttpServletResponse response){ + wpsConvertManage.downloadToPdfStream(fileId,response); + } + + @GetMapping("/test-core") + public String testCore() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; + String appKey = "A331101453557202109017383"; + + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, + "Fc3re2cq7r64Qfa7", HttpMethod.POST.name()); + String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" + + "dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" + + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; + + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + log.info(forEntity.getBody()); + return forEntity.getBody(); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java new file mode 100644 index 0000000..42b7401 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java @@ -0,0 +1,175 @@ +package com.ningdatech.pmapi.wps.manage; + +import cn.hutool.core.util.CharsetUtil; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.model.OSSObject; +import com.aliyun.oss.model.ObjectMetadata; +import com.ningdatech.file.properties.FileServerProperties; +import com.ningdatech.file.service.FileService; +import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.wps.contants.WpsContant; +import com.suwell.ofd.custom.agent.AtomAgent; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +/** + * @Classname WpsConvertManage + * @Description + * @Date 2023/8/14 13:42 + * @Author PoffyZhang + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class WpsConvertManage { + + @Resource + private FileService fileService; + + private final FileServerProperties fileServerProperties; + + @Value("${spring.profiles.active}") + private String active; + +// HTTPAgent ha = new HTTPAgent("http://127.0.0.1:8090"); + //2、定义方法实现 多个文件合并转为1个pdf文件 + public String offs2Pdf() { + AtomAgent ha = new AtomAgent("http://10.53.157.47"); + + try { + + //2-1、传参文件对象转换输出PDF文件 + //1)、定义集合,存储待转换的原文件 + List fileList =new ArrayList(); + //2)、定义转换后的pdf文件输出流 + OutputStream out = null; + //3)、添加原文件到集合 + fileList.add(new File("/temp/111.xlsx")); +// fileList.add(new File("D:/cs.doc")); +// fileList.add(new File("D:/a.pdf")); +// fileList.add(new File("D:\\555.ofd")); + //4)、赋值转换后的pdf文件输出流 + out=new FileOutputStream(new File("/temp/offices2_pdf.pdf")); + //5)、调用方法,执行将多个文件转为pdf文件 + ha.OFDToPDF(fileList, out); + + //2-2、传参文件流转换输出PDF文件(与2-1二选一即可) + //1)、定义集合,存储待转换的原文件(支持传文件流) +// Param[] params = new Param[] { +// new Param(PackEntry.wrap(new FileInputStream("D:\\temp\\111.ofd")), "ofd"), +// new Param(PackEntry.wrap(new FileInputStream("D:\\2.ofd")), "ofd"), +// new Param(PackEntry.wrap(new FileInputStream("D:\\T3.txt")), "txt") +// }; + //2)、赋值转换后的pdf文件输出流 +// out=new FileOutputStream(new File("D:/convert/offices_pdf.pdf")); + //3)、调用方法,执行将多个文件转为pdf文件 +// ha.OFDToPDF(params,out); + return "转换成功"; + } catch (Exception e) { + log.error(e.getMessage()); + } finally { + try { + //2-6、关闭资源 + ha.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return "转换失败"; + } + + public void downloadToPdfStream(Long fileId, HttpServletResponse response) { + com.ningdatech.file.entity.File file = fileService.getById(fileId); + downloadAndToPdf(file, response); + } + + private void downloadAndToPdf(com.ningdatech.file.entity.File file, HttpServletResponse response) { + OSS oss = new OSSClientBuilder().build(fileServerProperties.getAli().getEndpoint(), fileServerProperties.getAli().getAccessKeyId(), fileServerProperties.getAli().getAccessKeySecret()); + AtomAgent ha = new AtomAgent(WpsContant.WPS_CONVERT_URL_ONLINE); + try (OSSObject ossObject = oss.getObject(file.getBucket(), file.getPath()); + InputStream stream = ossObject.getObjectContent(); + ServletOutputStream outputStream = response.getOutputStream()) { + String fileName = null; + byte[] bytes = new byte[4096]; + int read; + //测试环境 转不了PDF 请求不了 WPS转换服务器 + if(BizConst.DEV.equals(active)){ + ObjectMetadata metadata = ossObject.getObjectMetadata(); + response.setContentType(metadata.getContentType()); + fileName = URLEncoder.encode(file.getOriginalFileName(), CharsetUtil.UTF_8); + response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName); + while ((read = stream.read(bytes)) != -1) { + outputStream.write(bytes, 0, read); + } + }else if(BizConst.PRE.equals(active) || + BizConst.PROD.equals(active)){ + String filePath = WpsContant.FIX_FILE_PATH + file.getOriginalFileName(); + convert(stream,filePath); + //转换PDF + List fileList =new ArrayList(); + //2)、定义转换后的pdf文件输出流 + OutputStream out = null; + //3)、添加原文件到集合 + fileList.add(new File(filePath)); + //4)、赋值转换后的pdf文件输出流 + File pdfFile = new File(WpsContant.PDF_PATH); + out = new FileOutputStream(pdfFile); + //5)、调用方法,执行将多个文件转为pdf文件 + ha.OFDToPDF(fileList, out); + FileInputStream fileInputStream = new FileInputStream(pdfFile); + response.setContentType(WpsContant.PDF_CONTENT_TYPE); + fileName = URLEncoder.encode(WpsContant.PDF_NAME, CharsetUtil.UTF_8); + response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName); + while ((read = fileInputStream.read(bytes)) != -1) { + outputStream.write(bytes, 0, read); + } + for(File f : fileList){ + //用完就删 + f.deleteOnExit(); + } + } + outputStream.flush(); + }catch (Exception e){ + log.error(e.getMessage()); + }finally { + oss.shutdown(); + try { + ha.close(); + } catch (IOException e) { + log.error(e.getMessage()); + } + } + } + + public static void convert(InputStream inputStream, String filePath) { + try { + File file = new File(filePath); + FileOutputStream outputStream = new FileOutputStream(file); + + int bytesRead; + byte[] buffer = new byte[1024]; + + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + outputStream.close(); + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/IConvertService.java b/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/IConvertService.java new file mode 100644 index 0000000..31ae6a7 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/IConvertService.java @@ -0,0 +1,5 @@ +package com.ningdatech.pmapi.wps.service; + +public interface IConvertService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/impl/ConvertService.java b/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/impl/ConvertService.java new file mode 100644 index 0000000..aef699a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/wps/service/impl/ConvertService.java @@ -0,0 +1,19 @@ +package com.ningdatech.pmapi.wps.service.impl; + +import com.ningdatech.pmapi.wps.service.IConvertService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Classname ConvertService + * @Description + * @Date 2023/8/15 10:56 + * @Author PoffyZhang + */ +@Service +@Slf4j +public class ConvertService implements IConvertService { + + + +} diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index 2c26136..2e4e1ea 100644 --- a/pmapi/src/main/resources/application-dev.yml +++ b/pmapi/src/main/resources/application-dev.yml @@ -216,6 +216,11 @@ irs: interfaceName: 3XN9R93Pva6db7sf appSecret: 496f0f2a19994f76b4fd9dae087366c7 appKey: A331101453557202109017383 + core-biz: + url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm + interfaceName: Fc3re2cq7r64Qfa7 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 interface-refresh: method: POST request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign} diff --git a/pmapi/src/main/resources/application-pre.yml b/pmapi/src/main/resources/application-pre.yml index feb4beb..12fd35d 100644 --- a/pmapi/src/main/resources/application-pre.yml +++ b/pmapi/src/main/resources/application-pre.yml @@ -219,6 +219,11 @@ irs: interfaceName: 3XN9R93Pva6db7sf appSecret: 496f0f2a19994f76b4fd9dae087366c7 appKey: A331101453557202109017383 + core-biz: + url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm + interfaceName: Fc3re2cq7r64Qfa7 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 interface-refresh: method: POST request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign} diff --git a/pmapi/src/main/resources/application-prod.yml b/pmapi/src/main/resources/application-prod.yml index 3ea6380..48fae2a 100644 --- a/pmapi/src/main/resources/application-prod.yml +++ b/pmapi/src/main/resources/application-prod.yml @@ -219,6 +219,11 @@ irs: interfaceName: 3XN9R93Pva6db7sf appSecret: 496f0f2a19994f76b4fd9dae087366c7 appKey: A331101453557202109017383 + core-biz: + url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm + interfaceName: Fc3re2cq7r64Qfa7 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 interface-refresh: method: POST request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign} diff --git a/pmapi/src/main/resources/security/auth-dev.yml b/pmapi/src/main/resources/security/auth-dev.yml index f878360..5c76021 100644 --- a/pmapi/src/main/resources/security/auth-dev.yml +++ b/pmapi/src/main/resources/security/auth-dev.yml @@ -36,6 +36,7 @@ security: - /file/download - /api/v1/zwdd/pull/** - /api/v1/irs/** + - /api/v1/wps-convert/** ignore-csrf-urls: - /api/v1/user/auth/** - /v2/api-docs @@ -64,6 +65,7 @@ security: - /file/download - /api/v1/zwdd/pull/** - /api/v1/irs/** + - /api/v1/wps-convert/** role-map: "engineer": "project_manager": diff --git a/pmapi/src/main/resources/security/auth-pre.yml b/pmapi/src/main/resources/security/auth-pre.yml index f878360..5c76021 100644 --- a/pmapi/src/main/resources/security/auth-pre.yml +++ b/pmapi/src/main/resources/security/auth-pre.yml @@ -36,6 +36,7 @@ security: - /file/download - /api/v1/zwdd/pull/** - /api/v1/irs/** + - /api/v1/wps-convert/** ignore-csrf-urls: - /api/v1/user/auth/** - /v2/api-docs @@ -64,6 +65,7 @@ security: - /file/download - /api/v1/zwdd/pull/** - /api/v1/irs/** + - /api/v1/wps-convert/** role-map: "engineer": "project_manager": diff --git a/pmapi/src/main/resources/security/auth-prod.yml b/pmapi/src/main/resources/security/auth-prod.yml index f878360..5c76021 100644 --- a/pmapi/src/main/resources/security/auth-prod.yml +++ b/pmapi/src/main/resources/security/auth-prod.yml @@ -36,6 +36,7 @@ security: - /file/download - /api/v1/zwdd/pull/** - /api/v1/irs/** + - /api/v1/wps-convert/** ignore-csrf-urls: - /api/v1/user/auth/** - /v2/api-docs @@ -64,6 +65,7 @@ security: - /file/download - /api/v1/zwdd/pull/** - /api/v1/irs/** + - /api/v1/wps-convert/** role-map: "engineer": "project_manager": diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java index 1b64794..a7f8f86 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/instance/InstanceTest.java @@ -4,12 +4,14 @@ import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.AppTests; +import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.service.IProjectInstService; import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; +import lombok.extern.slf4j.Slf4j; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; import org.flowable.engine.history.HistoricActivityInstance; @@ -29,6 +31,7 @@ import java.util.stream.Collectors; * @Date 2023/2/16 14:44 * @Author PoffyZhang */ +@Slf4j public class InstanceTest extends AppTests { @Autowired @@ -145,4 +148,43 @@ public class InstanceTest extends AppTests { } } + @Test + public void test4(){ + String nodeId = "node_64d1bc4694fc85e4dd1f1b36"; + + List hais = historyService.createHistoricActivityInstanceQuery() + .activityId(nodeId) + .unfinished() + .orderByHistoricActivityInstanceStartTime() + .asc() + .list(); + + log.info("hais :{}",JSON.toJSONString(hais)); + + if (CollUtil.isEmpty(hais)) { + log.info("没有查到 历史实例"); + return; + } + + String instanceId = hais.get(0).getProcessInstanceId(); + log.info("instanceId :{}",instanceId); + + //查询当前未完成的此实例 + HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() + .processInstanceId(instanceId) + .unfinished() + .singleResult(); + + log.info("instance :{}",JSON.toJSONString(instance)); + if (Objects.isNull(instance)) { + log.info("没有查到实例 或者 实例已经结束"); + return; + } + + //2.查到 此流程实例的 项目 + ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getInstCode, instanceId) + .last(BizConst.LIMIT_1)); + log.info("pi :{}",JSON.toJSONString(pi)); + } } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java index b5a4d53..2178c8a 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/irs/IrsTest.java @@ -50,7 +50,7 @@ public class IrsTest extends AppTests { public void test1() { String method = "GET"; String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" + - "?appCode=A331101453557202109017383"; + "?appCode=A331123467587202210014168"; String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c"; String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b"; @@ -76,7 +76,7 @@ public class IrsTest extends AppTests { String areaCode = "331123"; String appScret = "496f0f2a19994f76b4fd9dae087366c7"; String appKey = "A331101453557202109017383"; - String appCode = "A331123467587202307014170";//A331123467587202307014171 + String appCode = "A331123467587202307014177";//A331123467587202307014171 String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret); String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java index 6fa237a..8b58d19 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java @@ -24,7 +24,7 @@ import java.util.Objects; @Slf4j public class irsTest3 extends AppTests { - @Resource(name = "refreshToken") + @Resource private IRefreshTokenService refreshTokenService; @Value("${irs.interface-local-refresh.request-token-url}") @@ -74,7 +74,7 @@ public class irsTest3 extends AppTests { }else{ restTemplate = new RestTemplate(); } - String appId = "A330000100000202105005790"; + String appId = "A331123467587202307014177"; String updateTime = "2023-07-26 00:00:00"; String capCode = timestamp + updateTime + appId; String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/" + diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java new file mode 100644 index 0000000..9e0d31e --- /dev/null +++ b/pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest4.java @@ -0,0 +1,60 @@ +package com.ningdatech.pmapi.irs; + +import com.ningdatech.irs.service.IRefreshTokenService; +import com.ningdatech.pmapi.AppTests; +import com.ningdatech.pmapi.common.util.CryptUtils; +import com.ningdatech.pmapi.common.util.HttpUtil; +import lombok.extern.slf4j.Slf4j; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +import javax.annotation.Resource; +import java.security.NoSuchAlgorithmException; +import java.util.Objects; + +/** + * @Classname irsTest3 + * @Description + * @Date 2023/7/25 9:52 + * @Author PoffyZhang + */ +@Slf4j +public class irsTest4 extends AppTests { + @Resource + private IRefreshTokenService refreshTokenService; + + @Value("${irs.interface-refresh.request-token-url}") + private String govRequestTokenUrl; + @Value("${irs.interface-refresh.refresh-token-url}") + private String govRefreshTokenUrl; + + @Test + public void test1() throws NoSuchAlgorithmException { + long timestamp = System.currentTimeMillis(); + String appSecret = "496f0f2a19994f76b4fd9dae087366c7"; + String appKey = "A331101453557202109017383"; + String dataName = "大数据管理局"; + + String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, + "Fc3re2cq7r64Qfa7", HttpMethod.POST.name()); + String sign = CryptUtils.MD5Encode(appKey + secret + timestamp); + HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); + RestTemplate restTemplate; + if(Objects.nonNull(factory)){ + restTemplate = new RestTemplate(factory); + }else{ + restTemplate = new RestTemplate(); + } + + String url = "https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm?" + + "dingCode=&matterName=&oid=&useState=1&limit=1000&page=1" + + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp; + + ResponseEntity forEntity = restTemplate.getForEntity(url, String.class); + System.out.println(forEntity.getBody()); + } +} diff --git a/pmapi/src/test/resources/application-dev.yml b/pmapi/src/test/resources/application-dev.yml index b82eff6..f1cf086 100644 --- a/pmapi/src/test/resources/application-dev.yml +++ b/pmapi/src/test/resources/application-dev.yml @@ -240,6 +240,11 @@ irs: interfaceName: 3XN9R93Pva6db7sf appSecret: 496f0f2a19994f76b4fd9dae087366c7 appKey: A331101453557202109017383 + core-biz: + url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm + interfaceName: Fc3re2cq7r64Qfa7 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 interface-refresh: method: POST request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign} diff --git a/pmapi/src/test/resources/application-pre.yml b/pmapi/src/test/resources/application-pre.yml index 9f449f4..6319487 100644 --- a/pmapi/src/test/resources/application-pre.yml +++ b/pmapi/src/test/resources/application-pre.yml @@ -243,6 +243,11 @@ irs: interfaceName: 3XN9R93Pva6db7sf appSecret: 496f0f2a19994f76b4fd9dae087366c7 appKey: A331101453557202109017383 + core-biz: + url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm + interfaceName: Fc3re2cq7r64Qfa7 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 interface-refresh: method: POST request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign} diff --git a/pmapi/src/test/resources/application-prod.yml b/pmapi/src/test/resources/application-prod.yml index b777187..17f34d4 100644 --- a/pmapi/src/test/resources/application-prod.yml +++ b/pmapi/src/test/resources/application-prod.yml @@ -238,6 +238,11 @@ irs: interfaceName: 3XN9R93Pva6db7sf appSecret: 496f0f2a19994f76b4fd9dae087366c7 appKey: A331101453557202109017383 + core-biz: + url: https://interface.zjzwfw.gov.cn/gateway/api/001008012012001/dataSharing/Fc3re2cq7r64Qfa7.htm + interfaceName: Fc3re2cq7r64Qfa7 + appSecret: 496f0f2a19994f76b4fd9dae087366c7 + appKey: A331101453557202109017383 interface-refresh: method: POST request-token-url: https://interface.zjzwfw.gov.cn/gateway/app/refreshTokenByKey.htm?appKey={appKey}&requestTime={requestTime}&sign={sign}